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();
43 /// A destructor which deallocates attach panel resources.
47 if (isCreationSucceed &&
48 _attachPanel != IntPtr.Zero)
50 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.DestroyAttachPanel(_attachPanel);
52 _attachPanel = IntPtr.Zero;
57 /// Gets the state of the AttachPanel.
59 /// <value>The AttachPanel window state</value>
65 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out state);
72 /// Gets the value that indicates whether the AttachPanel is visible.
74 /// <value>visible value of AttachPanel state</value>
80 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetVisibility(_attachPanel, out visible);
87 /// Add a content category in the AttachPanel.
89 /// <param name="category">The ContentCategory to be added in the AttachPanel</param>
90 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
91 /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
92 /// <privilege>http://tizen.org/privilege/camera</privilege>
93 /// <privilege>http://tizen.org/privilege/recorder</privilege>
94 /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
95 /// <feature>http://tizen.org/feature/camera</feature>
96 /// <feature>http://tizen.org/feature/microphone</feature>
98 /// The caller app has to check the return value of this function.
99 /// Content categories will be shown as the sequence of using AddCategory
100 /// Some contents need time to load it all.
101 /// So, it is needed to use this before the mainloop of Show
103 /// http://tizen.org/privilege/mediastorage, for using Image or Camera
104 /// http://tizen.org/privilege/camera, for using Camera or TakePicture
105 /// http://tizen.org/privilege/recorder, for using Voice
106 /// http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab
107 /// http://tizen.org/feature/camera, for using Camera or TakePicture
108 /// http://tizen.org/feature/microphone, for using Voice
109 /// Deliver more information to the callee with a bundle if you need.
110 /// http://tizen.org/appcontrol/data/total_count
111 /// http://tizen.org/appcontrol/data/total_size
113 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
114 /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method</exception>
115 /// <exception cref="NotSupportedException">Thrown when the device does not supported the <paramref name="category"/> feature </exception>
116 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
117 public void AddCategory(ContentCategory category, Bundle extraData)
119 IntPtr bundle = IntPtr.Zero;
120 if (extraData != null)
122 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
124 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle);
129 /// Removes the ContentCategory from the AttachPanel
131 /// <param name="category">The ContentCategory adding in the AttachPanel</param>
132 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
133 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
134 public void RemoveCategory(ContentCategory category)
136 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category);
141 /// Sets extraData to send to the ContentCategory using a Bundle
143 /// <param name="category">The ContentCategory that some information to be set in the AttachPanel.</param>
144 /// <param name="extraData">The AttachPanel send some information using Bundle</param>
145 /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
146 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
147 /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
148 public void SetExtraData(ContentCategory category, Bundle extraData)
150 if(extraData == null)
152 checkException(Interop.AttachPanel.ErrorCode.InvalidParameter);
155 IntPtr bundle = IntPtr.Zero;
156 if (extraData != null)
158 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
160 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle);
165 /// Shows the attach panel with animations
167 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
170 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
175 /// Shows the attach panel and selects whether or not to animate
177 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
178 public void Show(bool animation)
182 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
187 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.ShowWithoutAnimation(_attachPanel);
193 /// Hides the attach panel with animations
195 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
198 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
203 /// Hides the attach panel and selects whether or not to animate
205 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
206 public void Hide(bool animation)
210 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
215 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel);
221 /// Occurs when reserved events are published from the panel-side.
223 public event EventHandler<StateEventArgs> EventChanged
227 if (_eventEventHandler == null)
229 StateEventListenStart();
231 _eventEventHandler += value;
235 _eventEventHandler -= value;
236 if (_eventEventHandler == null)
238 StateEventListenStop();
244 /// Occurs when an user selects and confirms something to attach in the AttachPanel
246 public event EventHandler<ResultEventArgs> ResultCallback
250 if (_resultEventHandler == null)
252 ResultEventListenStart();
254 _resultEventHandler += value;
258 _resultEventHandler -= value;
259 if (_resultEventHandler == null)
261 ResultEventListenStop();