4 namespace Tizen.Applications.AttachPanel
7 /// Represents immutable class for attach panel.
9 public partial class AttachPanel
12 /// Represents immutable class for attach panel.
14 /// <since_tizen> 3 </since_tizen>
15 /// <param name="conformant">The caller's conformant</param>
16 /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
17 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is already exist or the <paramref name="conformant"/> is not a conformant object</exception>
18 public AttachPanel(EvasObject conformant)
20 if (conformant == IntPtr.Zero)
22 throw new ArgumentNullException("Use the value property, not null value");
25 IntPtr candidateAttachPanel = new IntPtr();
26 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel);
29 Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
30 isCreationSucceed = true;
31 _attachPanel = candidateAttachPanel;
33 if (_eventEventHandler == null)
35 StateEventListenStart();
38 if (_resultEventHandler == null)
40 ResultEventListenStart();
45 /// Represents immutable class for attach panel.
47 /// <since_tizen> 3 </since_tizen>
48 /// <param name="conformant">The caller's conformant</param>
49 /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
50 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is already exist or the <paramref name="conformant"/> is not a conformant object</exception>
51 public AttachPanel(Conformant conformant)
53 if (conformant == IntPtr.Zero)
55 throw new ArgumentNullException("Use the value property, not null value");
58 IntPtr candidateAttachPanel = new IntPtr();
59 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel);
62 Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
63 isCreationSucceed = true;
64 _attachPanel = candidateAttachPanel;
66 if (_eventEventHandler == null)
68 StateEventListenStart();
71 if (_resultEventHandler == null)
73 ResultEventListenStart();
78 /// A destructor which deallocates attach panel resources.
82 if (isCreationSucceed &&
83 _attachPanel != IntPtr.Zero)
85 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.DestroyAttachPanel(_attachPanel);
87 _attachPanel = IntPtr.Zero;
92 /// Gets the state of the AttachPanel.
94 /// <value>The AttachPanel window state</value>
95 public StateType State
100 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out interopState);
102 StateType state = (StateType)Enum.ToObject(typeof(StateType), interopState);
108 /// Gets the value that indicates whether the AttachPanel is visible.
110 /// <value>visible value of AttachPanel state</value>
116 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetVisibility(_attachPanel, out visible);
118 return (visible == 1);
123 /// Add a content category in the AttachPanel.
125 /// <param name="category">The ContentCategory to be added in the AttachPanel</param>
126 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
127 /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
128 /// <privilege>http://tizen.org/privilege/camera</privilege>
129 /// <privilege>http://tizen.org/privilege/recorder</privilege>
130 /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
131 /// <feature>http://tizen.org/feature/camera</feature>
132 /// <feature>http://tizen.org/feature/microphone</feature>
134 /// The caller app has to check the return value of this function.
135 /// Content categories will be shown as the sequence of using AddCategory
136 /// Some contents need time to load it all.
137 /// So, it is needed to use this before the mainloop of Show
139 /// http://tizen.org/privilege/mediastorage, for using Image or Camera
140 /// http://tizen.org/privilege/camera, for using Camera or TakePicture
141 /// http://tizen.org/privilege/recorder, for using Voice
142 /// http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab
143 /// http://tizen.org/feature/camera, for using Camera or TakePicture
144 /// http://tizen.org/feature/microphone, for using Voice
145 /// Deliver more information to the callee with a bundle if you need.
146 /// http://tizen.org/appcontrol/data/total_count
147 /// http://tizen.org/appcontrol/data/total_size
149 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
150 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method</exception>
151 /// <exception cref="NotSupportedException">Thrown when the device does not supported the <paramref name="category"/> feature </exception>
152 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
153 public void AddCategory(ContentCategory category, Bundle extraData)
155 IntPtr bundle = IntPtr.Zero;
156 if (extraData != null)
158 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
161 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle);
166 /// Removes the ContentCategory from the AttachPanel
168 /// <param name="category">The ContentCategory adding in the AttachPanel</param>
169 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
170 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
171 public void RemoveCategory(ContentCategory category)
173 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category);
178 /// Sets extraData to send to the ContentCategory using a Bundle
180 /// <param name="category">The ContentCategory that some information to be set in the AttachPanel.</param>
181 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
182 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
183 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
184 /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
185 public void SetExtraData(ContentCategory category, Bundle extraData)
187 if (extraData == null)
189 CheckException(Interop.AttachPanel.ErrorCode.InvalidParameter);
192 IntPtr bundle = IntPtr.Zero;
193 if (extraData != null)
195 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
198 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle);
203 /// Shows the attach panel with animations
205 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
208 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
213 /// Shows the attach panel and selects whether or not to animate
215 /// <param name="animation">A flag which turn on or turn off the animation while attach panel showing.</param>
216 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
217 public void Show(bool animation)
221 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
226 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.ShowWithoutAnimation(_attachPanel);
232 /// Hides the attach panel with animations
234 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
237 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
242 /// Hides the attach panel and selects whether or not to animate
244 /// <param name="animation">A flag which turn on or turn off the animation while attach panel hiding.</param>
245 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
246 public void Hide(bool animation)
250 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
255 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel);
261 /// Occurs when reserved events are published from the panel-side.
263 public event EventHandler<StateEventArgs> EventChanged
267 if (_eventEventHandler == null)
269 StateEventListenStart();
272 _eventEventHandler += value;
277 _eventEventHandler -= value;
278 if (_eventEventHandler == null)
280 StateEventListenStop();
286 /// Occurs when an user selects and confirms something to attach in the AttachPanel
288 public event EventHandler<ResultEventArgs> ResultCallback
292 if (_resultEventHandler == null)
294 ResultEventListenStart();
297 _resultEventHandler += value;
302 _resultEventHandler -= value;
303 if (_resultEventHandler == null)
305 ResultEventListenStop();