Exemplo n.º 1
0
 static SelectionHandler Setup(FrameworkElement dobj)
 {
     var handler = GetHandler (dobj);
      if (handler == null)
      {
     handler = new SelectionHandler (dobj);
     SetHandler (dobj, handler);
      }
      return handler;
 }
Exemplo n.º 2
0
    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 ();
    }
Exemplo n.º 3
0
        /// <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
            {
            }
        }
Exemplo n.º 4
0
        /// <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);
                }
            }
        }
Exemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     toolbar = GameObject.Find ("Toolbar");
     wand = GameObject.Find ("Wand");
     virtualButtonHandler = toolbar.GetComponent <VirtualButtonEventHandler>();
     wandHandler = this.GetComponent <SelectionHandler> ();
 }
Exemplo n.º 6
0
        // ----------------------------------------------------------------------
partial         static void OnChange_Handler(FrameworkElement dobj, SelectionHandler oldValue, SelectionHandler newValue, ref bool handled);
Exemplo n.º 7
0
 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> ();
 }
Exemplo n.º 9
0
    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");
        }
    }
Exemplo n.º 10
0
 public void MakeSelection(int marks, object state, SelectionHandler callback)
 {
     MakeSelection(marks, null, state, callback);
 }
Exemplo n.º 11
0
    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");
        }
    }
Exemplo n.º 12
0
        /// <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;
        }
Exemplo n.º 13
0
 protected override void OnEnd()
 {
     container.Demolish();
     SelectionHandler.Clear();
     base.OnEnd();
 }
Exemplo n.º 14
0
 public void Repopulate(SelectionHandler selection, GeneValue[] possibleGeneValues, CromosomeAnalyzer _analyzer)
 {
     controller = new GeneticController(selection, possibleGeneValues, _analyzer, populationAmount, cromosomeAmount, cromosomeLength, mutationAmount, mutationRateOutOf100, selectionCount, iterationCount);
 }
Exemplo n.º 15
0
 public Genetic(SelectionHandler selection, GeneValue[] possibleGeneValues, CromosomeAnalyzer _analyzer)
 {
     Repopulate(selection, possibleGeneValues, _analyzer);
 }
Exemplo n.º 16
0
 public Unselected(SelectionHandler p)
 {
     parent = p;
 }