コード例 #1
0
        private void CloneAndEditSetting(bool makeClone)
        {
            if (Selected == null)
            {
                MessageBox.Show("Select configuration", "Not selected", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            int selectedIndex = InstancesList.SelectedIndex;

            AppInstance window = new AppInstance();
            var selectedItem = Selected;
            ApplicationInstance settingsCopy = Selected.MakeCopy();

            window.DataContext = settingsCopy;
            window.Owner = this;
            window.ShowDialog();
            if (window.DialogResult == true)
            {
                if (makeClone)
                {
                    _model.SiteConfig.Instances.Add(settingsCopy);
                    _model.SaveSettings();
                }
                else
                    _model.SiteConfig.Instances[selectedIndex] = settingsCopy;
            }
        }
コード例 #2
0
 private void buttonAddSetting_Click(object sender, RoutedEventArgs e)
 {
     ApplicationInstance model = new ApplicationInstance();
     AppInstance window = new AppInstance();
     window.DataContext = model;
     window.Owner = this;
     window.ShowDialog();
     if (window.DialogResult == true)
     {
         _model.SiteConfig.Instances.Add(model);
     }
 }