示例#1
0
        private void OKButton_Clicked(object sender, RoutedEventArgs e)
        {
            CentralAPI api = CentralAPI.Instance;

            if (api.Central.ServerURL != CentralInstanceTextBox.Text ||
                api.Central.APIKey != APIKeyTextBox.Text)
            {
                CentralServer newServer = new CentralServer();
                newServer.ServerURL = CentralInstanceTextBox.Text;
                newServer.APIKey    = APIKeyTextBox.Text;

                api.Central = newServer;
            }

            if (startupCheckbox.IsChecked.HasValue && (bool)startupCheckbox.IsChecked)
            {
                rk.SetValue(AppName, AppLocation);
            }
            else
            {
                string keyValue = rk.GetValue(AppName) as string;

                if (keyValue != null && keyValue.Equals(AppLocation))
                {
                    rk.DeleteValue(AppName);
                }
            }

            Close();
        }
示例#2
0
        private async void ToolbarItem_NewNetwork(object sender, System.Windows.RoutedEventArgs e)
        {
            if (CentralAPI.Instance.HasAccessToken())
            {
                CentralAPI     api        = CentralAPI.Instance;
                CentralNetwork newNetwork = await api.CreateNewNetwork();

                APIHandler handler = APIHandler.Instance;
                handler.JoinNetwork(this.Dispatcher, newNetwork.Id);

                string nodeId     = APIHandler.Instance.NodeAddress();
                bool   authorized = await CentralAPI.Instance.AuthorizeNode(nodeId, newNetwork.Id);
            }
        }
        public PageSwitcher()
        {
            InitializeComponent();
            Switcher.pageSwitcher = this;

            CentralAPI api = CentralAPI.Instance;

            if (api.HasAccessToken())
            {
                Switcher.Switch(new OnboardProcess.CreateOrJoin());
            }
            else
            {
                Switcher.Switch(new OnboardProcess.RegisterOrLogIn());
            }
        }
示例#4
0
        public PreferencesView()
        {
            InitializeComponent();


            string keyValue = rk.GetValue(AppName) as string;

            if (keyValue != null && keyValue.Equals(AppLocation))
            {
                startupCheckbox.IsChecked = true;
            }

            CentralAPI api = CentralAPI.Instance;

            CentralInstanceTextBox.Text = api.Central.ServerURL;
            APIKeyTextBox.Text          = api.Central.APIKey;
        }