예제 #1
0
 protected virtual void ValidateAndClose()
 {
     WitAuthUtility.ServerToken = serverToken;
     if (WitAuthUtility.IsServerTokenValid())
     {
         // Create configuration
         int index = CreateConfiguration(serverToken);
         if (index != -1)
         {
             // Complete
             Close();
             WitConfiguration c = WitConfigurationUtility.WitConfigs[index];
             if (successAction == null)
             {
                 WitWindowUtility.OpenConfigurationWindow(c);
             }
             else
             {
                 successAction(c);
             }
         }
     }
     else
     {
         throw new ArgumentException(WitTexts.Texts.SetupSubmitFailLabel);
     }
 }
예제 #2
0
        // Apply server token
        private void RelinkServerToken(bool closeIfInvalid)
        {
            // Open Setup if Invalid
            bool invalid = !WitConfigurationUtility.IsServerTokenValid(serverToken);

            if (invalid)
            {
                // Clear if desired
                if (string.IsNullOrEmpty(serverToken))
                {
                    WitAuthUtility.ServerToken = serverToken;
                }
                // Close if desired
                if (closeIfInvalid)
                {
                    // Open Setup
                    WitWindowUtility.OpenSetupWindow(WitWindowUtility.OpenConfigurationWindow);
                    // Close this Window
                    Close();
                }
                return;
            }

            // Set valid server token
            WitAuthUtility.ServerToken = serverToken;
            WitConfigurationUtility.SetServerToken(serverToken);
        }
예제 #3
0
 public static void OpenUnderstandingWindow()
 {
     WitWindowUtility.OpenUnderstandingWindow();
 }
예제 #4
0
 public static void OpenConfigurationWindow()
 {
     WitWindowUtility.OpenConfigurationWindow();
 }