2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Runtime.InteropServices;
20 using System.ComponentModel;
25 /// AutofillContainer controls several text input boxes.
27 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
28 [EditorBrowsable(EditorBrowsableState.Never)]
29 public class AutofillContainer : BaseHandle
31 private AuthenticationEventCallbackType authenticationCallback;
32 private ListEventCallbackType listCallback;
34 private event EventHandler<AuthenticationEventArgs> authenticationEventHandler;
35 private event EventHandler<ListEventArgs> listEventHandler;
37 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
38 private delegate void AuthenticationEventCallbackType(IntPtr autofillContainer);
39 private delegate void ListEventCallbackType(IntPtr control);
42 /// AutofillContainer Authentication Service Event.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public event EventHandler<AuthenticationEventArgs> ServiceEvent
50 if (authenticationEventHandler == null)
52 authenticationCallback = OnServiceEvent;
53 AutofillServiceEventSignal().Connect(authenticationCallback);
56 authenticationEventHandler += value;
60 authenticationEventHandler -= value;
62 if (authenticationEventHandler == null && authenticationCallback != null)
64 AutofillServiceEventSignal().Disconnect(authenticationCallback);
70 /// AutofillContainer Fill List Event.
72 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
73 [EditorBrowsable(EditorBrowsableState.Never)]
74 public event EventHandler<ListEventArgs> ListEvent
78 if (listEventHandler == null)
80 listCallback = OnListEvent;
81 AutofillListEventSignal().Connect(listCallback);
84 listEventHandler += value;
88 listEventHandler -= value;
90 if (listEventHandler == null && listCallback != null)
92 AutofillListEventSignal().Disconnect(listCallback);
100 /// <param name="name"> The AutofillContainer name</param>
101 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
102 [EditorBrowsable(EditorBrowsableState.Never)]
103 public AutofillContainer(string name) : this(Interop.AutofillContainer.New(name), true)
105 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108 internal AutofillContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
112 internal AutofillContainer(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
116 internal AutofillContainer(AutofillContainer autofillContainer) : this(Interop.AutofillContainer.NewAutofillContainer(AutofillContainer.getCPtr(autofillContainer)), true, false)
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 internal AutofillContainer Assign(AutofillContainer autofillContainer)
123 AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.Assign(SwigCPtr, AutofillContainer.getCPtr(autofillContainer)), false);
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 internal static AutofillContainer DownCast(BaseHandle handle)
130 AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.DownCast(BaseHandle.getCPtr(handle)), true);
131 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136 /// Adds View and its Autofill item information to Autofill Container.
138 /// <param name="view"> The view to be added to Autofill Container</param>
139 /// <param name="propertyIndex">The Property to be filled automatically of each View</param>
140 /// <param name="id"> A unique ID that does not always change on each launching</param>
141 /// <param name="label"> An auxiliary means to guess heuristically what data is</param>
142 /// <param name="hint"> The Hint - id (username), name, password, phone, credit card number, organization, and so on</param>
143 /// <param name="isSensitive"> Whether this information is a sensitive data or not</param>
144 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
145 [EditorBrowsable(EditorBrowsableState.Never)]
146 public void AddAutofillView(BaseComponents.View view, int propertyIndex, string id, string label, AutofillContainer.ItemHint hint, bool isSensitive)
148 Interop.AutofillContainer.AddAutofillView(SwigCPtr, BaseComponents.View.getCPtr(view), propertyIndex, id, label, (uint)hint, isSensitive);
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153 /// Removes View and its AutofillItem information to Autofill Container.
155 /// <param name="view"> The view to be removed to Autofill Container</param>
156 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 public void RemoveAutofillItem(BaseComponents.View view)
160 Interop.AutofillContainer.RemoveAutofillItem(SwigCPtr, BaseComponents.View.getCPtr(view));
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165 /// Stores autofill data.
167 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 public void SaveAutofillData()
171 Interop.AutofillContainer.SaveAutofillData(SwigCPtr);
172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176 /// Sends a request for filling the data.
178 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
179 [EditorBrowsable(EditorBrowsableState.Never)]
180 public void RequestFillData()
182 Interop.AutofillContainer.RequestFillData(SwigCPtr);
183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187 /// Gets the Autofill Service Name.
189 /// <returns>Autofill Service Name</returns>
190 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
191 [EditorBrowsable(EditorBrowsableState.Never)]
192 public string GetAutofillServiceName()
194 string ret = Interop.AutofillContainer.GetAutofillServiceName(SwigCPtr);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200 /// Gets the Autofill Service Message.
202 /// <returns>Autofill Service Message</returns>
203 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
204 [EditorBrowsable(EditorBrowsableState.Never)]
205 public string GetAutofillServiceMessage()
207 string ret = Interop.AutofillContainer.GetAutofillServiceMessage(SwigCPtr);
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213 /// Gets the Autofill Service Image Path.
215 /// <returns>Autofill Service Image Path</returns>
216 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
217 [EditorBrowsable(EditorBrowsableState.Never)]
218 public string GetAutofillServiceImagePath()
220 string ret = Interop.AutofillContainer.GetAutofillServiceImagePath(SwigCPtr);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226 /// Gets the number of list items. (The presentation text of Autofill)
228 /// <returns>The number of list items</returns>
229 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
230 [EditorBrowsable(EditorBrowsableState.Never)]
231 public uint GetListItemCount()
233 uint ret = Interop.AutofillContainer.GetListItemCount(SwigCPtr);
234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239 /// Gets the list item of the index.
241 /// <param name="index">The index for the list</param>
242 /// <returns>The list item of the index</returns>
243 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
244 [EditorBrowsable(EditorBrowsableState.Never)]
245 public string GetListItem(uint index)
247 string ret = Interop.AutofillContainer.GetListItem(SwigCPtr, index);
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 /// Sets the selected item to fill out.
255 /// <param name="selected">The selected item</param>
256 /// <since_tizen> 5 </since_tizen>
257 public void SetSelectedItem(string selected)
259 Interop.AutofillContainer.SetSelectedItem(SwigCPtr, selected);
260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 internal AuthenticationSignalType AutofillServiceEventSignal()
266 AuthenticationSignalType ret = new AuthenticationSignalType(Interop.AutofillContainer.AutofillServiceEventSignal(SwigCPtr), false);
267 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271 internal ListEventSignalType AutofillListEventSignal()
273 ListEventSignalType ret = new ListEventSignalType(Interop.AutofillContainer.AutofillListEventSignal(SwigCPtr), false);
274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
282 [EditorBrowsable(EditorBrowsableState.Never)]
283 protected override void Dispose(DisposeTypes type)
290 //Release your own unmanaged resources here.
291 //You should not access any managed member here except static instance.
292 //because the execution order of Finalizes is non-deterministic.
295 if (authenticationCallback != null)
297 AutofillServiceEventSignal().Disconnect(authenticationCallback);
300 if (listCallback != null)
302 AutofillListEventSignal().Disconnect(listCallback);
309 /// This will not be public opened.
310 [EditorBrowsable(EditorBrowsableState.Never)]
311 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
313 Interop.AutofillContainer.DeleteAutofillContainer(swigCPtr);
316 private void OnServiceEvent(IntPtr autofillContainer)
318 AuthenticationEventArgs e = new AuthenticationEventArgs();
319 e.AutofillContainer = Registry.GetManagedBaseHandleFromNativePtr(autofillContainer) as AutofillContainer;
321 if (authenticationEventHandler != null)
323 authenticationEventHandler(this, e);
327 private void OnListEvent(IntPtr control)
329 ListEventArgs e = new ListEventArgs();
330 e.Control = Registry.GetManagedBaseHandleFromNativePtr(control) as BaseComponents.View;
332 if (listEventHandler != null)
334 listEventHandler(this, e);
339 /// Event arguments that passed via the Authentication event.
341 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
342 [EditorBrowsable(EditorBrowsableState.Never)]
343 public class AuthenticationEventArgs : EventArgs
346 /// The instance of AutofillContainer
348 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
349 [EditorBrowsable(EditorBrowsableState.Never)]
350 public AutofillContainer AutofillContainer
358 /// AutofillContainer list event arguments.
360 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
361 [EditorBrowsable(EditorBrowsableState.Never)]
362 public class ListEventArgs : EventArgs
365 /// The instance of AutofillContainer
367 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
368 [EditorBrowsable(EditorBrowsableState.Never)]
369 public BaseComponents.View Control
378 /// Enumeration for hint of the autofill item.
380 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
381 [EditorBrowsable(EditorBrowsableState.Never)]
385 /// Autofill hint for a credit card expiration date
387 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
388 [EditorBrowsable(EditorBrowsableState.Never)]
389 CreditCardExpirationData,
391 /// Autofill hint for a credit card expiration day
393 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
394 [EditorBrowsable(EditorBrowsableState.Never)]
395 CreditCardExpirationDay,
397 /// Autofill hint for a credit card expiration month
399 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
400 [EditorBrowsable(EditorBrowsableState.Never)]
401 CreditCardExpirationMonth,
403 /// Autofill hint for a credit card expiration year
405 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
406 [EditorBrowsable(EditorBrowsableState.Never)]
407 CreditCardExpirationYear,
409 /// Autofill hint for a credit card number
411 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
412 [EditorBrowsable(EditorBrowsableState.Never)]
415 /// Autofill hint for an email address
417 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
418 [EditorBrowsable(EditorBrowsableState.Never)]
421 /// Autofill hint for a user's real name
423 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
424 [EditorBrowsable(EditorBrowsableState.Never)]
427 /// Autofill hint for a phone number
429 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
430 [EditorBrowsable(EditorBrowsableState.Never)]
433 /// Autofill hint for a postal address
435 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
436 [EditorBrowsable(EditorBrowsableState.Never)]
439 /// Autofill hint for a postal code
441 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
442 [EditorBrowsable(EditorBrowsableState.Never)]
445 /// Autofill hint for a user's ID
447 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
448 [EditorBrowsable(EditorBrowsableState.Never)]
451 /// Autofill hint for password
453 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
454 [EditorBrowsable(EditorBrowsableState.Never)]
457 /// Autofill hint for a credit card security code
459 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
460 [EditorBrowsable(EditorBrowsableState.Never)]
461 CreditCardSecurityCode