Ejemplo n.º 1
0
        /// <summary>
        /// Method executes when the SuggestionBox signals that editing location
        /// has been OK'ed (user pressed enter) or cancel'ed (user pressed Escape).
        ///
        /// These signals are then recorded and processed via IsSwitchOn property
        /// handler which can also be invoked via Toggle Button which is processed
        /// as OK.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Control_SuggestBox_NewLocationRequestEvent(object sender,
                                                                SuggestBoxLib.Events.NextTargetLocationArgs e)
        {
            // The user requests a new location via SuggestBox textbox key gesture:
            // Enter  -> OK
            // Escape -> Cancel
            string action = "Unknown";

            switch (e.EditResult.Result)
            {
            case EditPathResult.Cancel:
                action = "Cancel";
                break;

            case EditPathResult.OK:
                action = "OK";
                break;

            default:
                throw new System.NotImplementedException(e.EditResult.Result.ToString());
            }

            if (string.IsNullOrEmpty(e.EditResult.NewLocation) == false)
            {
                NewLocationRequestEventDisplay.Text =
                    string.Format("({0}) '{1}'", action, e.EditResult.NewLocation);
            }
            else
            {
                NewLocationRequestEventDisplay.Text = string.Format("{0}", action);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Method executes when the SuggestionBox signals that editing location
 /// has been OK'ed (user pressed enter) or cancel'ed (user pressed Escape).
 ///
 /// These signals are then recorded and processed via IsSwitchOn property
 /// handler which can also be invoked via Toggle Button which is processed
 /// as OK.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Control_SuggestBox_NewLocationRequestEvent(object sender,
                                                         SuggestBoxLib.Events.NextTargetLocationArgs e)
 {
     // The user requests a new location via SuggestBox Text control
     // lets have the switch do the lifting of navigating the tree view
     if (IsSwitchOn == false)
     {
         if (this.SwitchCommand.CanExecute(null) == true)
         {
             this.SwitchCommand.Execute(e.EditResult);
         }
     }
 }