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) : base(cPtr, cMemoryOwn)
112 internal AutofillContainer(AutofillContainer autofillContainer) : this(Interop.AutofillContainer.NewAutofillContainer(AutofillContainer.getCPtr(autofillContainer)), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 internal AutofillContainer Assign(AutofillContainer autofillContainer)
119 AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.Assign(SwigCPtr, AutofillContainer.getCPtr(autofillContainer)), false);
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 internal static AutofillContainer DownCast(BaseHandle handle)
126 AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.DownCast(BaseHandle.getCPtr(handle)), true);
127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132 /// Adds View and its Autofill item information to Autofill Container.
134 /// <param name="view"> The view to be added to Autofill Container</param>
135 /// <param name="propertyIndex">The Property to be filled automatically of each View</param>
136 /// <param name="id"> A unique ID that does not always change on each launching</param>
137 /// <param name="label"> An auxiliary means to guess heuristically what data is</param>
138 /// <param name="hint"> The Hint - id (username), name, password, phone, credit card number, organization, and so on</param>
139 /// <param name="isSensitive"> Whether this information is a sensitive data or not</param>
140 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
141 [EditorBrowsable(EditorBrowsableState.Never)]
142 public void AddAutofillView(BaseComponents.View view, int propertyIndex, string id, string label, AutofillContainer.ItemHint hint, bool isSensitive)
144 Interop.AutofillContainer.AddAutofillView(SwigCPtr, BaseComponents.View.getCPtr(view), propertyIndex, id, label, (uint)hint, isSensitive);
145 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149 /// Removes View and its AutofillItem information to Autofill Container.
151 /// <param name="view"> The view to be removed to Autofill Container</param>
152 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
153 [EditorBrowsable(EditorBrowsableState.Never)]
154 public void RemoveAutofillItem(BaseComponents.View view)
156 Interop.AutofillContainer.RemoveAutofillItem(SwigCPtr, BaseComponents.View.getCPtr(view));
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 /// Stores autofill data.
163 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
164 [EditorBrowsable(EditorBrowsableState.Never)]
165 public void SaveAutofillData()
167 Interop.AutofillContainer.SaveAutofillData(SwigCPtr);
168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172 /// Sends a request for filling the data.
174 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
175 [EditorBrowsable(EditorBrowsableState.Never)]
176 public void RequestFillData()
178 Interop.AutofillContainer.RequestFillData(SwigCPtr);
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 /// Gets the Autofill Service Name.
185 /// <returns>Autofill Service Name</returns>
186 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
187 [EditorBrowsable(EditorBrowsableState.Never)]
188 public string GetAutofillServiceName()
190 string ret = Interop.AutofillContainer.GetAutofillServiceName(SwigCPtr);
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 /// Gets the Autofill Service Message.
198 /// <returns>Autofill Service Message</returns>
199 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
200 [EditorBrowsable(EditorBrowsableState.Never)]
201 public string GetAutofillServiceMessage()
203 string ret = Interop.AutofillContainer.GetAutofillServiceMessage(SwigCPtr);
204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209 /// Gets the Autofill Service Image Path.
211 /// <returns>Autofill Service Image Path</returns>
212 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
213 [EditorBrowsable(EditorBrowsableState.Never)]
214 public string GetAutofillServiceImagePath()
216 string ret = Interop.AutofillContainer.GetAutofillServiceImagePath(SwigCPtr);
217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222 /// Gets the number of list items. (The presentation text of Autofill)
224 /// <returns>The number of list items</returns>
225 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
226 [EditorBrowsable(EditorBrowsableState.Never)]
227 public uint GetListItemCount()
229 uint ret = Interop.AutofillContainer.GetListItemCount(SwigCPtr);
230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 /// Gets the list item of the index.
237 /// <param name="index">The index for the list</param>
238 /// <returns>The list item of the index</returns>
239 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
240 [EditorBrowsable(EditorBrowsableState.Never)]
241 public string GetListItem(uint index)
243 string ret = Interop.AutofillContainer.GetListItem(SwigCPtr, index);
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 /// Sets the selected item to fill out.
251 /// <param name="selected">The selected item</param>
252 /// <since_tizen> 5 </since_tizen>
253 public void SetSelectedItem(string selected)
255 Interop.AutofillContainer.SetSelectedItem(SwigCPtr, selected);
256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259 internal AuthenticationSignalType AutofillServiceEventSignal()
262 AuthenticationSignalType ret = new AuthenticationSignalType(Interop.AutofillContainer.AutofillServiceEventSignal(SwigCPtr), false);
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 internal ListEventSignalType AutofillListEventSignal()
269 ListEventSignalType ret = new ListEventSignalType(Interop.AutofillContainer.AutofillListEventSignal(SwigCPtr), false);
270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
278 [EditorBrowsable(EditorBrowsableState.Never)]
279 protected override void Dispose(DisposeTypes type)
286 //Release your own unmanaged resources here.
287 //You should not access any managed member here except static instance.
288 //because the execution order of Finalizes is non-deterministic.
291 if (authenticationCallback != null)
293 AutofillServiceEventSignal().Disconnect(authenticationCallback);
296 if (listCallback != null)
298 AutofillListEventSignal().Disconnect(listCallback);
305 /// This will not be public opened.
306 [EditorBrowsable(EditorBrowsableState.Never)]
307 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
309 Interop.AutofillContainer.DeleteAutofillContainer(swigCPtr);
312 private void OnServiceEvent(IntPtr autofillContainer)
314 AuthenticationEventArgs e = new AuthenticationEventArgs();
315 e.AutofillContainer = Registry.GetManagedBaseHandleFromNativePtr(autofillContainer) as AutofillContainer;
317 if (authenticationEventHandler != null)
319 authenticationEventHandler(this, e);
323 private void OnListEvent(IntPtr control)
325 ListEventArgs e = new ListEventArgs();
326 e.Control = Registry.GetManagedBaseHandleFromNativePtr(control) as BaseComponents.View;
328 if (listEventHandler != null)
330 listEventHandler(this, e);
335 /// Event arguments that passed via the Authentication event.
337 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
338 [EditorBrowsable(EditorBrowsableState.Never)]
339 public class AuthenticationEventArgs : EventArgs
342 /// The instance of AutofillContainer
344 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
345 [EditorBrowsable(EditorBrowsableState.Never)]
346 public AutofillContainer AutofillContainer
354 /// AutofillContainer list event arguments.
356 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
357 [EditorBrowsable(EditorBrowsableState.Never)]
358 public class ListEventArgs : EventArgs
361 /// The instance of AutofillContainer
363 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
364 [EditorBrowsable(EditorBrowsableState.Never)]
365 public BaseComponents.View Control
374 /// Enumeration for hint of the autofill item.
376 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
377 [EditorBrowsable(EditorBrowsableState.Never)]
381 /// Autofill hint for a credit card expiration date
383 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
384 [EditorBrowsable(EditorBrowsableState.Never)]
385 CreditCardExpirationData,
387 /// Autofill hint for a credit card expiration day
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 CreditCardExpirationDay,
393 /// Autofill hint for a credit card expiration month
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 CreditCardExpirationMonth,
399 /// Autofill hint for a credit card expiration year
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 CreditCardExpirationYear,
405 /// Autofill hint for a credit card number
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)]
411 /// Autofill hint for an email address
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 a user's real name
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 phone number
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 postal address
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 code
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 user's ID
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 password
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 a credit card security code
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)]
457 CreditCardSecurityCode