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> 4 </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> 4 </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 /// <since_tizen> 4 </since_tizen>
96 public StateType State
101 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out interopState);
103 StateType state = (StateType)Enum.ToObject(typeof(StateType), interopState);
109 /// Gets the value that indicates whether the AttachPanel is visible.
111 /// <value>visible value of AttachPanel state</value>
112 /// <since_tizen> 4 </since_tizen>
118 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetVisibility(_attachPanel, out visible);
120 return (visible == 1);
125 /// Add a content category in the AttachPanel.
127 /// <param name="category">The ContentCategory to be added in the AttachPanel</param>
128 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
129 /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
130 /// <privilege>http://tizen.org/privilege/camera</privilege>
131 /// <privilege>http://tizen.org/privilege/recorder</privilege>
132 /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
133 /// <feature>http://tizen.org/feature/camera</feature>
134 /// <feature>http://tizen.org/feature/microphone</feature>
136 /// The caller app has to check the return value of this function.
137 /// Content categories will be shown as the sequence of using AddCategory
138 /// Some contents need time to load it all.
139 /// So, it is needed to use this before the mainloop of Show
141 /// http://tizen.org/privilege/mediastorage, for using Image or Camera
142 /// http://tizen.org/privilege/camera, for using Camera or TakePicture
143 /// http://tizen.org/privilege/recorder, for using Voice
144 /// http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab
145 /// http://tizen.org/feature/camera, for using Camera or TakePicture
146 /// http://tizen.org/feature/microphone, for using Voice
147 /// Deliver more information to the callee with a bundle if you need.
148 /// http://tizen.org/appcontrol/data/total_count
149 /// http://tizen.org/appcontrol/data/total_size
151 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
152 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method</exception>
153 /// <exception cref="NotSupportedException">Thrown when the device does not supported the <paramref name="category"/> feature </exception>
154 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
155 /// <since_tizen> 4 </since_tizen>
156 public void AddCategory(ContentCategory category, Bundle extraData)
158 IntPtr bundle = IntPtr.Zero;
159 if (extraData != null)
161 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
164 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle);
169 /// Removes the ContentCategory from the AttachPanel
171 /// <param name="category">The ContentCategory adding in the AttachPanel</param>
172 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
173 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
174 /// <since_tizen> 4 </since_tizen>
175 public void RemoveCategory(ContentCategory category)
177 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category);
182 /// Sets extraData to send to the ContentCategory using a Bundle
184 /// <param name="category">The ContentCategory that some information to be set in the AttachPanel.</param>
185 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
186 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
187 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
188 /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
189 /// <since_tizen> 4 </since_tizen>
190 public void SetExtraData(ContentCategory category, Bundle extraData)
192 if (extraData == null)
194 CheckException(Interop.AttachPanel.ErrorCode.InvalidParameter);
197 IntPtr bundle = IntPtr.Zero;
198 if (extraData != null)
200 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
203 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle);
208 /// Shows the attach panel with animations
210 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
211 /// <since_tizen> 4 </since_tizen>
214 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
219 /// Shows the attach panel and selects whether or not to animate
221 /// <param name="animation">A flag which turn on or turn off the animation while attach panel showing.</param>
222 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
223 /// <since_tizen> 4 </since_tizen>
224 public void Show(bool animation)
228 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
233 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.ShowWithoutAnimation(_attachPanel);
239 /// Hides the attach panel with animations
241 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
242 /// <since_tizen> 4 </since_tizen>
245 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
250 /// Hides the attach panel and selects whether or not to animate
252 /// <param name="animation">A flag which turn on or turn off the animation while attach panel hiding.</param>
253 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
254 /// <since_tizen> 4 </since_tizen>
255 public void Hide(bool animation)
259 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
264 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel);
270 /// Occurs when reserved events are published from the panel-side.
272 /// <since_tizen> 4 </since_tizen>
273 public event EventHandler<StateEventArgs> EventChanged
277 if (_eventEventHandler == null)
279 StateEventListenStart();
282 _eventEventHandler += value;
287 _eventEventHandler -= value;
288 if (_eventEventHandler == null)
290 StateEventListenStop();
296 /// Occurs when an user selects and confirms something to attach in the AttachPanel
298 /// <since_tizen> 4 </since_tizen>
299 public event EventHandler<ResultEventArgs> ResultCallback
303 if (_resultEventHandler == null)
305 ResultEventListenStart();
308 _resultEventHandler += value;
313 _resultEventHandler -= value;
314 if (_resultEventHandler == null)
316 ResultEventListenStop();