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 IntPtr candidateAttachPanel = new IntPtr();
24 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel);
27 Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
28 isCreationSucceed = true;
29 _attachPanel = candidateAttachPanel;
31 if (_eventEventHandler == null)
33 StateEventListenStart();
36 if (_resultEventHandler == null)
38 ResultEventListenStart();
44 if (isCreationSucceed &&
45 _attachPanel != IntPtr.Zero)
47 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.DestroyAttachPanel(_attachPanel);
49 _attachPanel = IntPtr.Zero;
54 /// Gets the state of the AttachPanel.
56 /// <value>The AttachPanel window state</value>
62 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out state);
69 /// Gets the value that indicates whether the AttachPanel is visible.
71 /// <value>visible value of AttachPanel state</value>
77 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetVisibility(_attachPanel, out visible);
84 /// Add a content category in the AttachPanel.
86 /// <param name="category">The ContentCategory to be added in the AttachPanel</param>
87 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
88 /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
89 /// <privilege>http://tizen.org/privilege/camera</privilege>
90 /// <privilege>http://tizen.org/privilege/recorder</privilege>
91 /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
92 /// <feature>http://tizen.org/feature/camera</feature>
93 /// <feature>http://tizen.org/feature/microphone</feature>
95 /// The caller app has to check the return value of this function.
96 /// Content categories will be shown as the sequence of using AddCategory
97 /// Some contents need time to load it all.
98 /// So, it is needed to use this before the mainloop of Show
100 /// http://tizen.org/privilege/mediastorage, for using Image or Camera
101 /// http://tizen.org/privilege/camera, for using Camera or TakePicture
102 /// http://tizen.org/privilege/recorder, for using Voice
103 /// http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab
104 /// http://tizen.org/feature/camera, for using Camera or TakePicture
105 /// http://tizen.org/feature/microphone, for using Voice
106 /// Deliver more information to the callee with a bundle if you need.
107 /// http://tizen.org/appcontrol/data/total_count
108 /// http://tizen.org/appcontrol/data/total_size
110 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
111 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method</exception>
112 /// <exception cref="NotSupportedException">Thrown when the device does not supported the <paramref name="category"/> feature </exception>
113 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
114 public void AddCategory(ContentCategory category, Bundle extraData)
116 IntPtr bundle = IntPtr.Zero;
117 if (extraData != null)
119 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
121 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle);
126 /// Removes the ContentCategory from the AttachPanel
128 /// <param name="category">The ContentCategory adding in the AttachPanel</param>
129 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
130 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
131 public void RemoveCategory(ContentCategory category)
133 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category);
138 /// Sets extraData to send to the ContentCategory using a Bundle
140 /// <param name="category">The ContentCategory that some information to be set in the AttachPanel.</param>
141 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
142 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
143 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
144 /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
145 public void SetExtraData(ContentCategory category, Bundle extraData)
147 if(extraData == null)
149 checkException(Interop.AttachPanel.ErrorCode.InvalidParameter);
152 IntPtr bundle = IntPtr.Zero;
153 if (extraData != null)
155 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
157 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle);
162 /// Shows the attach panel with animations
164 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
167 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
172 /// Shows the attach panel and selects whether or not to animate
174 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
175 public void Show(bool animation)
179 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
184 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.ShowWithoutAnimation(_attachPanel);
190 /// Hides the attach panel with animations
192 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
195 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
200 /// Hides the attach panel and selects whether or not to animate
202 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
203 public void Hide(bool animation)
207 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
212 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel);
218 /// Occurs when reserved events are published from the panel-side.
220 public event EventHandler<StateEventArgs> EventChanged
224 if (_eventEventHandler == null)
226 StateEventListenStart();
228 _eventEventHandler += value;
232 _eventEventHandler -= value;
233 if (_eventEventHandler == null)
235 StateEventListenStop();
241 /// Occurs when an user selects and confirms something to attach in the AttachPanel
243 public event EventHandler<ResultEventArgs> ResultCallback
247 if (_resultEventHandler == null)
249 ResultEventListenStart();
251 _resultEventHandler += value;
255 _resultEventHandler -= value;
256 if (_resultEventHandler == null)
258 ResultEventListenStop();