2 * Copyright(c) 2019 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
32 private AuthenticationEventCallbackType _authenticationCallback;
33 private ListEventCallbackType _listCallback;
35 private event EventHandler<AuthenticationEventArgs> _authenticationEventHandler;
36 private event EventHandler<ListEventArgs> _listEventHandler;
38 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
39 private delegate void AuthenticationEventCallbackType(IntPtr autofillContainer);
40 private delegate void ListEventCallbackType(IntPtr control);
43 /// AutofillContainer Authentication Service Event.
45 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
46 [EditorBrowsable(EditorBrowsableState.Never)]
47 public event EventHandler<AuthenticationEventArgs> ServiceEvent
51 if (_authenticationEventHandler == null)
53 _authenticationCallback = OnServiceEvent;
54 AutofillServiceEventSignal().Connect(_authenticationCallback);
57 _authenticationEventHandler += value;
61 _authenticationEventHandler -= value;
63 if (_authenticationEventHandler == null && _authenticationCallback != null)
65 AutofillServiceEventSignal().Disconnect(_authenticationCallback);
71 /// AutofillContainer Fill List Event.
73 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
74 [EditorBrowsable(EditorBrowsableState.Never)]
75 public event EventHandler<ListEventArgs> ListEvent
79 if (_listEventHandler == null)
81 _listCallback = OnListEvent;
82 AutofillListEventSignal().Connect(_listCallback);
85 _listEventHandler += value;
89 _listEventHandler -= value;
91 if (_listEventHandler == null && _listCallback != null)
93 AutofillListEventSignal().Disconnect(_listCallback);
101 /// <param name="name"> The AutofillContainer name</param>
102 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
103 [EditorBrowsable(EditorBrowsableState.Never)]
104 public AutofillContainer(string name) : this(Interop.AutofillContainer.New(name), true)
106 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110 internal AutofillContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.AutofillContainer.Upcast(cPtr), cMemoryOwn)
115 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AutofillContainer obj)
117 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
120 internal AutofillContainer(AutofillContainer autofillContainer) : this(Interop.AutofillContainer.NewAutofillContainer(AutofillContainer.getCPtr(autofillContainer)), true)
122 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125 internal AutofillContainer Assign(AutofillContainer autofillContainer)
127 AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.Assign(SwigCPtr, AutofillContainer.getCPtr(autofillContainer)), false);
128 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132 internal static AutofillContainer DownCast(BaseHandle handle)
134 AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.DownCast(BaseHandle.getCPtr(handle)), true);
135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140 /// Adds View and its Autofill item information to Autofill Container.
142 /// <param name="view"> The view to be added to Autofill Container</param>
143 /// <param name="propertyIndex">The Property to be filled automatically of each View</param>
144 /// <param name="id"> A unique ID that does not always change on each launching</param>
145 /// <param name="label"> An auxiliary means to guess heuristically what data is</param>
146 /// <param name="hint"> The Hint - id (username), name, password, phone, credit card number, organization, and so on</param>
147 /// <param name="isSensitive"> Whether this information is a sensitive data or not</param>
148 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
149 [EditorBrowsable(EditorBrowsableState.Never)]
150 public void AddAutofillView(BaseComponents.View view, int propertyIndex, string id, string label, AutofillContainer.ItemHint hint, bool isSensitive)
152 Interop.AutofillContainer.AddAutofillView(SwigCPtr, BaseComponents.View.getCPtr(view), propertyIndex, id, label, (uint)hint, isSensitive);
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 /// Removes View and its AutofillItem information to Autofill Container.
159 /// <param name="view"> The view to be removed to Autofill Container</param>
160 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
161 [EditorBrowsable(EditorBrowsableState.Never)]
162 public void RemoveAutofillItem(BaseComponents.View view)
164 Interop.AutofillContainer.RemoveAutofillItem(SwigCPtr, BaseComponents.View.getCPtr(view));
165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169 /// Stores autofill data.
171 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
172 [EditorBrowsable(EditorBrowsableState.Never)]
173 public void SaveAutofillData()
175 Interop.AutofillContainer.SaveAutofillData(SwigCPtr);
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 /// Sends a request for filling the data.
182 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
183 [EditorBrowsable(EditorBrowsableState.Never)]
184 public void RequestFillData()
186 Interop.AutofillContainer.RequestFillData(SwigCPtr);
187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191 /// Gets the Autofill Service Name.
193 /// <returns>Autofill Service Name</returns>
194 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
195 [EditorBrowsable(EditorBrowsableState.Never)]
196 public string GetAutofillServiceName()
198 string ret = Interop.AutofillContainer.GetAutofillServiceName(SwigCPtr);
199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 /// Gets the Autofill Service Message.
206 /// <returns>Autofill Service Message</returns>
207 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
208 [EditorBrowsable(EditorBrowsableState.Never)]
209 public string GetAutofillServiceMessage()
211 string ret = Interop.AutofillContainer.GetAutofillServiceMessage(SwigCPtr);
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217 /// Gets the Autofill Service Image Path.
219 /// <returns>Autofill Service Image Path</returns>
220 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
221 [EditorBrowsable(EditorBrowsableState.Never)]
222 public string GetAutofillServiceImagePath()
224 string ret = Interop.AutofillContainer.GetAutofillServiceImagePath(SwigCPtr);
225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230 /// Gets the number of list items. (The presentation text of Autofill)
232 /// <returns>The number of list items</returns>
233 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
234 [EditorBrowsable(EditorBrowsableState.Never)]
235 public uint GetListItemCount()
237 uint ret = Interop.AutofillContainer.GetListItemCount(SwigCPtr);
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243 /// Gets the list item of the index.
245 /// <param name="index">The index for the list</param>
246 /// <returns>The list item of the index</returns>
247 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
248 [EditorBrowsable(EditorBrowsableState.Never)]
249 public string GetListItem(uint index)
251 string ret = Interop.AutofillContainer.GetListItem(SwigCPtr, index);
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
257 /// Sets the selected item to fill out.
259 /// <param name="selected">The selected item</param>
260 /// <since_tizen> 5 </since_tizen>
261 public void SetSelectedItem(string selected)
263 Interop.AutofillContainer.SetSelectedItem(SwigCPtr, selected);
264 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 internal AuthenticationSignalType AutofillServiceEventSignal()
270 AuthenticationSignalType ret = new AuthenticationSignalType(Interop.AutofillContainer.AutofillServiceEventSignal(SwigCPtr), false);
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 internal ListEventSignalType AutofillListEventSignal()
277 ListEventSignalType ret = new ListEventSignalType(Interop.AutofillContainer.AutofillListEventSignal(SwigCPtr), false);
278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
285 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
286 [EditorBrowsable(EditorBrowsableState.Never)]
287 protected override void Dispose(DisposeTypes type)
294 //Release your own unmanaged resources here.
295 //You should not access any managed member here except static instance.
296 //because the execution order of Finalizes is non-deterministic.
300 if (_authenticationCallback != null)
302 AutofillServiceEventSignal().Disconnect(_authenticationCallback);
305 if (_listCallback != null)
307 AutofillListEventSignal().Disconnect(_listCallback);
314 /// This will not be public opened.
315 [EditorBrowsable(EditorBrowsableState.Never)]
316 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
318 Interop.AutofillContainer.DeleteAutofillContainer(swigCPtr);
321 private void OnServiceEvent(IntPtr autofillContainer)
323 AuthenticationEventArgs e = new AuthenticationEventArgs();
324 e.AutofillContainer = Registry.GetManagedBaseHandleFromNativePtr(autofillContainer) as AutofillContainer;
326 if (_authenticationEventHandler != null)
328 _authenticationEventHandler(this, e);
332 private void OnListEvent(IntPtr control)
334 ListEventArgs e = new ListEventArgs();
335 e.Control = Registry.GetManagedBaseHandleFromNativePtr(control) as BaseComponents.View;
337 if (_listEventHandler != null)
339 _listEventHandler(this, e);
344 /// Event arguments that passed via the Authentication event.
346 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
347 [EditorBrowsable(EditorBrowsableState.Never)]
348 public class AuthenticationEventArgs : EventArgs
351 /// The instance of AutofillContainer
353 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
354 [EditorBrowsable(EditorBrowsableState.Never)]
355 public AutofillContainer AutofillContainer
363 /// AutofillContainer list event arguments.
365 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
366 [EditorBrowsable(EditorBrowsableState.Never)]
367 public class ListEventArgs : EventArgs
370 /// The instance of AutofillContainer
372 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
373 [EditorBrowsable(EditorBrowsableState.Never)]
374 public BaseComponents.View Control
383 /// Enumeration for hint of the autofill item.
385 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
386 [EditorBrowsable(EditorBrowsableState.Never)]
390 /// Autofill hint for a credit card expiration date
392 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
393 [EditorBrowsable(EditorBrowsableState.Never)]
394 CreditCardExpirationData,
396 /// Autofill hint for a credit card expiration day
398 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
399 [EditorBrowsable(EditorBrowsableState.Never)]
400 CreditCardExpirationDay,
402 /// Autofill hint for a credit card expiration month
404 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
405 [EditorBrowsable(EditorBrowsableState.Never)]
406 CreditCardExpirationMonth,
408 /// Autofill hint for a credit card expiration year
410 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
411 [EditorBrowsable(EditorBrowsableState.Never)]
412 CreditCardExpirationYear,
414 /// Autofill hint for a credit card number
416 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
417 [EditorBrowsable(EditorBrowsableState.Never)]
420 /// Autofill hint for an email address
422 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
423 [EditorBrowsable(EditorBrowsableState.Never)]
426 /// Autofill hint for a user's real name
428 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
429 [EditorBrowsable(EditorBrowsableState.Never)]
432 /// Autofill hint for a phone number
434 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
435 [EditorBrowsable(EditorBrowsableState.Never)]
438 /// Autofill hint for a postal address
440 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
441 [EditorBrowsable(EditorBrowsableState.Never)]
444 /// Autofill hint for a postal code
446 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
447 [EditorBrowsable(EditorBrowsableState.Never)]
450 /// Autofill hint for a user's ID
452 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
453 [EditorBrowsable(EditorBrowsableState.Never)]
456 /// Autofill hint for password
458 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
459 [EditorBrowsable(EditorBrowsableState.Never)]
462 /// Autofill hint for a credit card security code
464 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
465 [EditorBrowsable(EditorBrowsableState.Never)]
466 CreditCardSecurityCode