Beispiel #1
0
        private void EditConnexButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Confirm edit DragoConnex?"
                                                      , "Edit DragoConnex"
                                                      , MessageBoxButton.YesNo
                                                      , MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                string      dragoConnexID     = "";
                RadButton   dragoConnexButton = sender as RadButton;
                DragoConnex dragoConnex       = (dragoConnexButton.DataContext as DragoConnex);
                dragoConnexID = dragoConnex.DragoConnexID ?? "";

                if (!string.IsNullOrEmpty(dragoConnexID))
                {
                    Dictionary <string, string> dict = JsonConvert.DeserializeObject <Dictionary <string, string> >(dragoConnex.DragoSetting);

                    MainWindow mainWindow = Application.Current.MainWindow as MainWindow;
                    var        MainFrame  = mainWindow.MainFrame;

                    Connex_Config_Page connexConfigPage = new Connex_Config_Page(dragoConnexID);
                    MainFrame.NavigationService.RemoveBackEntry();
                    MainFrame.Navigate(connexConfigPage);
                }
            }
        }
Beispiel #2
0
        public async Task <DragoConnex> CreateDragoConnexAsync(DragoConnex DragoConnex)
        {
            HttpResponseMessage response = await client.PostAsJsonAsync("DragoConnex", DragoConnex);

            var dragoConnex = new DragoConnex();

            if (response.IsSuccessStatusCode)
            {
                var dragoConnexResult = response.Content.ReadAsStringAsync().Result;
                dragoConnex = JsonConvert.DeserializeObject <DragoConnex>(dragoConnexResult);

                return(dragoConnex);
            }
            return(null);
        }
Beispiel #3
0
        [Obsolete] //Ball : Doesn't work, don't know why
        public async Task <DragoConnex> GetDragoconnexAsync(string m_dragoConnexID)
        {
            string              path          = "http://dragoservices.azurewebsites.net/api/DragoAdmin/DragoConnex/" + m_dragoConnexID;
            DragoConnex         m_dragoConnex = new DragoConnex();
            HttpResponseMessage response      = await client.GetAsync(path);

            if (response.IsSuccessStatusCode)
            {
                var DragoConnex = response.Content.ReadAsStringAsync().Result;
                m_dragoConnex = JsonConvert.DeserializeObject <DragoConnex>(DragoConnex);
            }
            else
            {
                return(null);
            }
            return(m_dragoConnex);
        }
Beispiel #4
0
        private void CreateConfigButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Confirm create config files?"
                                                      , "Create Config Files"
                                                      , MessageBoxButton.YesNo
                                                      , MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                string    dragoConnexID     = "";
                RadButton dragoConnexButton = sender as RadButton;
                dragoConnexID = (dragoConnexButton.DataContext as DragoConnex).DragoConnexID ?? "";
                if (!string.IsNullOrEmpty(dragoConnexID))
                {
                    DragoConnex target = dragoConnexes.SingleOrDefault(x => x.DragoConnexID == dragoConnexID);
                    if (target != null)
                    {
                        if (string.IsNullOrEmpty(target.DragoSetting))
                        {
                            MessageBox.Show("DragoConnex has no setting specified"
                                            , "Create Config Files"
                                            , MessageBoxButton.OK
                                            , MessageBoxImage.Warning);
                        }
                        else
                        {
                            CreateConfigFile(target.DragoSetting, target.DragoConnexID);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Invalid DragoConnex ID"
                                    , "Create Config Files"
                                    , MessageBoxButton.OK
                                    , MessageBoxImage.Warning);
                }
            }
        }