static SelectionHandler Setup(FrameworkElement dobj) { var handler = GetHandler (dobj); if (handler == null) { handler = new SelectionHandler (dobj); SetHandler (dobj, handler); } return handler; }
public void Activate() { isActive = true; selectionHandler = new SelectionHandler (new List<string> () {"Change Username", "Change Password", "Logout: " + ParseUser.CurrentUser.Username, "Menu"}); InputManager.Instance.SetInputListener (this); PromptOptions (); if(optionsListener != null) optionsListener.OnOptionsActivate (); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> private void Dispose(bool all) { try { if (all) { LinkClicked = null; Refresh = null; RenderError = null; StylesheetLoad = null; ImageLoad = null; } _cssData = null; if (_root != null) _root.Dispose(); _root = null; if (_selectionHandler != null) _selectionHandler.Dispose(); _selectionHandler = null; } catch { } }
/// <summary> /// Init with optional document and stylesheet. /// </summary> /// <param name="htmlSource">the html to init with, init empty if not given</param> /// <param name="baseCssData">optional: the stylesheet to init with, init default if not given</param> public void SetHtml(string htmlSource, CssData baseCssData = null) { if(_root != null) { _root.Dispose(); _root = null; if (_selectionHandler != null) _selectionHandler.Dispose(); _selectionHandler = null; } if (!string.IsNullOrEmpty(htmlSource)) { _cssData = baseCssData ?? CssUtils.DefaultCssData; _root = DomParser.GenerateCssTree(htmlSource, this, ref _cssData); if (_root != null) { _selectionHandler = new SelectionHandler(_root); } } }
// Use this for initialization void Start() { toolbar = GameObject.Find ("Toolbar"); wand = GameObject.Find ("Wand"); virtualButtonHandler = toolbar.GetComponent <VirtualButtonEventHandler>(); wandHandler = this.GetComponent <SelectionHandler> (); }
// ---------------------------------------------------------------------- partial static void OnChange_Handler(FrameworkElement dobj, SelectionHandler oldValue, SelectionHandler newValue, ref bool handled);
public static void SetHandler(FrameworkElement dobj, SelectionHandler value) { if (dobj != null) { dobj.SetValue (HandlerProperty, value); } }
// Use this for initialization void Start() { handler = this.GetComponent <SelectionHandler> (); }
private IEnumerator ChangeUsernameCoroutine(string usernameStr) { string cachedUsername = ParseUser.CurrentUser.Username; ParseUser.CurrentUser.Username = usernameStr; Task changeTask = ParseUser.CurrentUser.SaveAsync (); DateTime startTime = DateTime.UtcNow; TimeSpan waitDuration = TimeSpan.FromSeconds(TimeUtils.TIMEOUT_DURATION); while (!changeTask.IsCompleted) { if(DateTime.UtcNow - startTime >= waitDuration) break; yield return null; } if(!changeTask.IsCompleted) { errorInfo = new ErrorInfo(ErrorType.Timeout); optionsState = OptionsState.Error; } else if (changeTask.IsFaulted) { using (IEnumerator<System.Exception> enumerator = changeTask.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException exception = (ParseException) enumerator.Current; errorInfo = new ErrorInfo(ErrorType.ParseException, exception.Code); } else { errorInfo = new ErrorInfo(ErrorType.ParseInternal); } } optionsState = OptionsState.Error; } if (optionsState != OptionsState.Error) { AsyncWriter.StopWriting(); selectionHandler = new SelectionHandler (new List<string> () {"Change Username", "Change Password", "Logout: " + ParseUser.CurrentUser.Username, "Menu"}); PromptOptions(); } else { ParseUser.CurrentUser.Username = cachedUsername; AsyncWriter.WriteTextInstant (errorInfo.GetErrorStr() + "\n" + "[Tap] to return\n"); } }
public void MakeSelection(int marks, object state, SelectionHandler callback) { MakeSelection(marks, null, state, callback); }
private IEnumerator ChangePasswordCoroutine(string passwordStr) { // TODO: MAY BE BUGGY SINCE INSTANCE PARSEUSER WILL RETAIN CHANGED PASSWORD REGARDLESS OF WHETHER SAVE WAS SUCCESSFUL ParseUser.CurrentUser.Password = passwordStr; Task changeTask = ParseUser.CurrentUser.SaveAsync (); DateTime startTime = DateTime.UtcNow; TimeSpan waitDuration = TimeSpan.FromSeconds(TimeUtils.TIMEOUT_DURATION); while (!changeTask.IsCompleted) { if(DateTime.UtcNow - startTime >= waitDuration) break; yield return null; } if(!changeTask.IsCompleted) { errorInfo = new ErrorInfo(ErrorType.Timeout); optionsState = OptionsState.Error; } else if (changeTask.IsFaulted) { using (IEnumerator<System.Exception> enumerator = changeTask.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException exception = (ParseException) enumerator.Current; errorInfo = new ErrorInfo(ErrorType.ParseException, exception.Code); } else { errorInfo = new ErrorInfo(ErrorType.ParseInternal); } } optionsState = OptionsState.Error; } if (optionsState != OptionsState.Error) { AsyncWriter.StopWriting(); selectionHandler = new SelectionHandler (new List<string> () {"Change Username", "Change Password", "Logout: " + ParseUser.CurrentUser.Username, "Menu"}); PromptOptions(); } else { AsyncWriter.WriteTextInstant (errorInfo.GetErrorStr() + "\n" + "[Tap] to return\n"); } }
/// <summary> /// Init. /// </summary> /// <param name="selectionHandler">the selection handler linked to the context menu handler</param> /// <param name="htmlContainer">the html container the handler is on</param> public ContextMenuHandler(SelectionHandler selectionHandler, HtmlContainer htmlContainer) { ArgChecker.AssertArgNotNull(selectionHandler, "selectionHandler"); ArgChecker.AssertArgNotNull(htmlContainer, "htmlContainer"); _selectionHandler = selectionHandler; _htmlContainer = htmlContainer; }
protected override void OnEnd() { container.Demolish(); SelectionHandler.Clear(); base.OnEnd(); }
public void Repopulate(SelectionHandler selection, GeneValue[] possibleGeneValues, CromosomeAnalyzer _analyzer) { controller = new GeneticController(selection, possibleGeneValues, _analyzer, populationAmount, cromosomeAmount, cromosomeLength, mutationAmount, mutationRateOutOf100, selectionCount, iterationCount); }
public Genetic(SelectionHandler selection, GeneValue[] possibleGeneValues, CromosomeAnalyzer _analyzer) { Repopulate(selection, possibleGeneValues, _analyzer); }
public Unselected(SelectionHandler p) { parent = p; }