3 namespace Tizen.Applications.AttachPanel
6 /// Represents immutable class for attach panel.
8 public partial class AttachPanel
11 /// Represents immutable class for attach panel.
13 /// <since_tizen> 3 </since_tizen>
14 /// <param name="conformant">The caller's conformant</param>
15 /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
16 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is already exist or the <paramref name="conformant"/> is not a conformant object</exception>
17 public AttachPanel(IntPtr conformant)
19 if (conformant == IntPtr.Zero)
21 throw new ArgumentNullException("Use the value property, not null value");
23 _attachPanel = new IntPtr();
24 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref _attachPanel);
27 if (_eventEventHandler == null)
29 StateEventListenStart();
32 if (_resultEventHandler == null)
34 ResultEventListenStart();
40 if (_attachPanel != IntPtr.Zero)
42 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.DestroyAttachPanel(_attachPanel);
44 _attachPanel = IntPtr.Zero;
49 /// Gets the state of the AttachPanel.
51 /// <value>The AttachPanel window state</value>
57 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out state);
64 /// Gets the value that indicates whether the AttachPanel is visible.
66 /// <value>visible value of AttachPanel state</value>
72 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetVisibility(_attachPanel, out visible);
79 /// Add a content category in the AttachPanel.
81 /// <param name="category">The ContentCategory to be added in the AttachPanel</param>
82 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
83 /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
84 /// <privilege>http://tizen.org/privilege/camera</privilege>
85 /// <privilege>http://tizen.org/privilege/recorder</privilege>
86 /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
88 /// The caller app has to check the return value of this function.
89 /// Content categories will be shown as the sequence of using AddCategory
90 /// Some contents need time to load it all.
91 /// So, it is needed to use this before the mainloop of Show
93 /// http://tizen.org/privilege/mediastorage, for using Image or Camera
94 /// http://tizen.org/privilege/camera, for using Camera or TakePicture
95 /// http://tizen.org/privilege/recorder, for using Voice
96 /// http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab
97 /// Deliver more information to the callee with a bundle if you need.
98 /// http://tizen.org/appcontrol/data/total_count
99 /// http://tizen.org/appcontrol/data/total_size
101 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
102 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method</exception>
103 /// <exception cref="NotSupportedException">Thrown when the device does not supported the <paramref name="category"/> feature </exception>
104 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
105 public void AddCategory(ContentCategory category, Bundle extraData)
107 IntPtr bundle = IntPtr.Zero;
108 if (extraData != null)
110 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
112 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle);
117 /// Removes the ContentCategory from the AttachPanel
119 /// <param name="category">The ContentCategory adding in the AttachPanel</param>
120 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
121 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
122 public void RemoveCategory(ContentCategory category)
124 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category);
129 /// Sets extraData to send to the ContentCategory using a Bundle
131 /// <param name="category">The ContentCategory that some information to be set in the AttachPanel.</param>
132 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
133 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
134 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
135 /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
136 public void SetExtraData(ContentCategory category, Bundle extraData)
138 IntPtr bundle = IntPtr.Zero;
139 if (extraData != null)
141 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
143 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle);
148 /// Shows the attach panel with animations
150 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
153 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
158 /// Shows the attach panel and selects whether or not to animate
160 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
161 public void Show(bool animation)
165 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
170 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.ShowWithoutAnimation(_attachPanel);
176 /// Hides the attach panel with animations
178 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
181 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
186 /// Hides the attach panel and selects whether or not to animate
188 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
189 public void Hide(bool animation)
193 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
198 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel);
204 /// Occurs when reserved events are published from the panel-side.
206 public event EventHandler<StateEventArgs> EventChanged
210 if (_eventEventHandler == null)
212 StateEventListenStart();
214 _eventEventHandler += value;
218 _eventEventHandler -= value;
219 if (_eventEventHandler == null)
221 StateEventListenStop();
227 /// Occurs when an user selects and confirms something to attach in the AttachPanel
229 public event EventHandler<ResultEventArgs> ResultCallback
233 if (_resultEventHandler == null)
235 ResultEventListenStart();
237 _resultEventHandler += value;
241 _resultEventHandler -= value;
242 if (_resultEventHandler == null)
244 ResultEventListenStop();