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.StdCall)]
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) : base(cPtr, cMemoryOwn)
113 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AutofillContainer obj)
115 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
118 internal AutofillContainer(AutofillContainer autofillContainer) : this(Interop.AutofillContainer.NewAutofillContainer(AutofillContainer.getCPtr(autofillContainer)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 internal AutofillContainer Assign(AutofillContainer autofillContainer)
125 AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.Assign(SwigCPtr, AutofillContainer.getCPtr(autofillContainer)), false);
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130 internal static AutofillContainer DownCast(BaseHandle handle)
132 AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.DownCast(BaseHandle.getCPtr(handle)), true);
133 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138 /// Adds View and its Autofill item information to Autofill Container.
140 /// <param name="view"> The view to be added to Autofill Container</param>
141 /// <param name="propertyIndex">The Property to be filled automatically of each View</param>
142 /// <param name="id"> A unique ID that does not always change on each launching</param>
143 /// <param name="label"> An auxiliary means to guess heuristically what data is</param>
144 /// <param name="hint"> The Hint - id (username), name, password, phone, credit card number, organization, and so on</param>
145 /// <param name="isSensitive"> Whether this information is a sensitive data or not</param>
146 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
147 [EditorBrowsable(EditorBrowsableState.Never)]
148 public void AddAutofillView(BaseComponents.View view, int propertyIndex, string id, string label, AutofillContainer.ItemHint hint, bool isSensitive)
150 Interop.AutofillContainer.AddAutofillView(SwigCPtr, BaseComponents.View.getCPtr(view), propertyIndex, id, label, (uint)hint, isSensitive);
151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155 /// Removes View and its AutofillItem information to Autofill Container.
157 /// <param name="view"> The view to be removed to Autofill Container</param>
158 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
159 [EditorBrowsable(EditorBrowsableState.Never)]
160 public void RemoveAutofillItem(BaseComponents.View view)
162 Interop.AutofillContainer.RemoveAutofillItem(SwigCPtr, BaseComponents.View.getCPtr(view));
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 /// Stores autofill data.
169 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public void SaveAutofillData()
173 Interop.AutofillContainer.SaveAutofillData(SwigCPtr);
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 /// Sends a request for filling the data.
180 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
181 [EditorBrowsable(EditorBrowsableState.Never)]
182 public void RequestFillData()
184 Interop.AutofillContainer.RequestFillData(SwigCPtr);
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 /// Gets the Autofill Service Name.
191 /// <returns>Autofill Service Name</returns>
192 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
193 [EditorBrowsable(EditorBrowsableState.Never)]
194 public string GetAutofillServiceName()
196 string ret = Interop.AutofillContainer.GetAutofillServiceName(SwigCPtr);
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 /// Gets the Autofill Service Message.
204 /// <returns>Autofill Service Message</returns>
205 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
206 [EditorBrowsable(EditorBrowsableState.Never)]
207 public string GetAutofillServiceMessage()
209 string ret = Interop.AutofillContainer.GetAutofillServiceMessage(SwigCPtr);
210 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 /// Gets the Autofill Service Image Path.
217 /// <returns>Autofill Service Image Path</returns>
218 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
219 [EditorBrowsable(EditorBrowsableState.Never)]
220 public string GetAutofillServiceImagePath()
222 string ret = Interop.AutofillContainer.GetAutofillServiceImagePath(SwigCPtr);
223 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 /// Gets the number of list items. (The presentation text of Autofill)
230 /// <returns>The number of list items</returns>
231 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
232 [EditorBrowsable(EditorBrowsableState.Never)]
233 public uint GetListItemCount()
235 uint ret = Interop.AutofillContainer.GetListItemCount(SwigCPtr);
236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 /// Gets the list item of the index.
243 /// <param name="index">The index for the list</param>
244 /// <returns>The list item of the index</returns>
245 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
246 [EditorBrowsable(EditorBrowsableState.Never)]
247 public string GetListItem(uint index)
249 string ret = Interop.AutofillContainer.GetListItem(SwigCPtr, index);
250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255 /// Sets the selected item to fill out.
257 /// <param name="selected">The selected item</param>
258 /// <since_tizen> 5 </since_tizen>
259 public void SetSelectedItem(string selected)
261 Interop.AutofillContainer.SetSelectedItem(SwigCPtr, selected);
262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 internal AuthenticationSignalType AutofillServiceEventSignal()
268 AuthenticationSignalType ret = new AuthenticationSignalType(Interop.AutofillContainer.AutofillServiceEventSignal(SwigCPtr), false);
269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 internal ListEventSignalType AutofillListEventSignal()
275 ListEventSignalType ret = new ListEventSignalType(Interop.AutofillContainer.AutofillListEventSignal(SwigCPtr), false);
276 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
284 [EditorBrowsable(EditorBrowsableState.Never)]
285 protected override void Dispose(DisposeTypes type)
292 //Release your own unmanaged resources here.
293 //You should not access any managed member here except static instance.
294 //because the execution order of Finalizes is non-deterministic.
297 if (authenticationCallback != null)
299 AutofillServiceEventSignal().Disconnect(authenticationCallback);
302 if (listCallback != null)
304 AutofillListEventSignal().Disconnect(listCallback);
311 /// This will not be public opened.
312 [EditorBrowsable(EditorBrowsableState.Never)]
313 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
315 Interop.AutofillContainer.DeleteAutofillContainer(swigCPtr);
318 private void OnServiceEvent(IntPtr autofillContainer)
320 AuthenticationEventArgs e = new AuthenticationEventArgs();
321 e.AutofillContainer = Registry.GetManagedBaseHandleFromNativePtr(autofillContainer) as AutofillContainer;
323 if (authenticationEventHandler != null)
325 authenticationEventHandler(this, e);
329 private void OnListEvent(IntPtr control)
331 ListEventArgs e = new ListEventArgs();
332 e.Control = Registry.GetManagedBaseHandleFromNativePtr(control) as BaseComponents.View;
334 if (listEventHandler != null)
336 listEventHandler(this, e);
341 /// Event arguments that passed via the Authentication event.
343 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
344 [EditorBrowsable(EditorBrowsableState.Never)]
345 public class AuthenticationEventArgs : EventArgs
348 /// The instance of AutofillContainer
350 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
351 [EditorBrowsable(EditorBrowsableState.Never)]
352 public AutofillContainer AutofillContainer
360 /// AutofillContainer list event arguments.
362 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
363 [EditorBrowsable(EditorBrowsableState.Never)]
364 public class ListEventArgs : EventArgs
367 /// The instance of AutofillContainer
369 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
370 [EditorBrowsable(EditorBrowsableState.Never)]
371 public BaseComponents.View Control
380 /// Enumeration for hint of the autofill item.
382 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
383 [EditorBrowsable(EditorBrowsableState.Never)]
387 /// Autofill hint for a credit card expiration date
389 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
390 [EditorBrowsable(EditorBrowsableState.Never)]
391 CreditCardExpirationData,
393 /// Autofill hint for a credit card expiration day
395 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
396 [EditorBrowsable(EditorBrowsableState.Never)]
397 CreditCardExpirationDay,
399 /// Autofill hint for a credit card expiration month
401 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
402 [EditorBrowsable(EditorBrowsableState.Never)]
403 CreditCardExpirationMonth,
405 /// Autofill hint for a credit card expiration year
407 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
408 [EditorBrowsable(EditorBrowsableState.Never)]
409 CreditCardExpirationYear,
411 /// Autofill hint for a credit card number
413 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
414 [EditorBrowsable(EditorBrowsableState.Never)]
417 /// Autofill hint for an email address
419 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
420 [EditorBrowsable(EditorBrowsableState.Never)]
423 /// Autofill hint for a user's real name
425 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
426 [EditorBrowsable(EditorBrowsableState.Never)]
429 /// Autofill hint for a phone number
431 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
432 [EditorBrowsable(EditorBrowsableState.Never)]
435 /// Autofill hint for a postal address
437 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
438 [EditorBrowsable(EditorBrowsableState.Never)]
441 /// Autofill hint for a postal code
443 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
444 [EditorBrowsable(EditorBrowsableState.Never)]
447 /// Autofill hint for a user's ID
449 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
450 [EditorBrowsable(EditorBrowsableState.Never)]
453 /// Autofill hint for password
455 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
456 [EditorBrowsable(EditorBrowsableState.Never)]
459 /// Autofill hint for a credit card security code
461 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
462 [EditorBrowsable(EditorBrowsableState.Never)]
463 CreditCardSecurityCode