Exemplo n.º 1
0
        public oAuth2(WPFWindow window, string AppName, string ClientID = null, string ClientSecret = null)
        {
            _window        = window;
            _appdata       = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            _file_path     = _appdata + @"\LINKS\Customization\Plugins\oAuth2\";
            _app_name      = AppName;
            _client_id     = ClientID;
            _client_secret = ClientSecret;
            _xmlFilePath   = _file_path + _app_name + ".xml";
            _jsonFilePath  = _file_path + _app_name + ".json";
            _refresh_token = getElementFromXML("refresh_token");

            if (!Directory.Exists(_file_path))
            {
                Directory.CreateDirectory(_file_path);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method to initialize test window
        /// Sets visuals for the window
        /// </summary>
        internal void InitializeWindow(string appName, string elementName, string exeMode)
        {
            // Initialize Window Instance
            wpfTest = new WPFWindow();

            try
            {
                if (wpfTest.LINKSInitialized())
                {
                    // Get Templates for controls
                    // Note: This will not work on v2.6.2.3 or older
                    ControlTemplate buttonTemplate   = (ControlTemplate)jarvisWPF.App.Current.FindResource("ButtonControl_CutLeftRight");
                    ControlTemplate textBoxTemplate  = (ControlTemplate)jarvisWPF.App.Current.FindResource("TextBox_ControlTemplate");
                    ControlTemplate checkBoxTemplate = (ControlTemplate)jarvisWPF.App.Current.FindResource("CheckBox_ControlTemplate");
                    ControlTemplate comboBoxTemplate = (ControlTemplate)jarvisWPF.App.Current.FindResource("ComboBox_ControlTemplate");

                    // Apply templates
                    // Note: This will not work on v2.6.2.3 or older
                    //wpfTest.test_comboBox.Template = comboBoxTemplate;
                    //wpfTest.test_button_Speak.Template = buttonTemplate;
                    //wpfTest.test_textBox_Speak.Template = textBoxTemplate;
                    //wpfTest.test_textBox_Emulate.Template = textBoxTemplate;
                    //wpfTest.button_cancel.Template = buttonTemplate;
                    //wpfTest.checkBox_LoadOnStart.Template = checkBoxTemplate;
                }
            }
            catch
            {
                //Console.WriteLine("Not all templates work on v2.6.2.3 or older. Only Button Template can work after commenting out the rest of the template lines.");
            }

            // Set properties
            //wpfTest.test_comboBox.IsDropDownOpen = false;
            //wpfTest.test_comboBox.Visibility = Visibility.Hidden;
            //wpfTest.checkBox_LoadOnStart.IsChecked = Properties.Settings.Default.LoadOnStart;
            //wpfTest.test_labelBlock_LoadOnStart.FontFamily = jarvisWPF.PublicClass.GetFont();

            wpfTest.Show();
            wpfTest.Closed += (s, e) => Dispatcher.ExitAllFrames();
            elementValue    = It.authWindowThread.GetElement(appName, elementName, exeMode);
            //wpfTest.loadAuthUrl();
            //It.Test_FormClose();

            //Dispatcher.Run();
        }