Пример #1
0
        public void AddConnectionItem()
        {
            var dialog = new ConnectionItemEditViewModel();

            if (dialog.ShowDialog() == true)
            {
                this.connectionItems.Add(dialog.ConnectionInfo);
                this.connectionItems.Write();
            }
        }
Пример #2
0
 protected override void OnExecute(object parameter)
 {
     if (this.cremaAppHost.IsOpened == false && parameter is ConnectionItemViewModel connectionItem)
     {
         var dialog = new ConnectionItemEditViewModel()
         {
             DisplayName = Resources.Title_CopyConnectionItem,
             ConnectionInfo = connectionItem.Clone(),
         };
         if (dialog.ShowDialog() == true)
         {
             this.cremaAppHost.ConnectionItems.Add(dialog.ConnectionInfo);
         }
     }
 }
Пример #3
0
        public void EditConnectionItem(ConnectionItemViewModel connectionItem)
        {
            var dialog = new ConnectionItemEditViewModel(connectionItem.Clone());

            if (dialog.ShowDialog() == true)
            {
                connectionItem.Assign(dialog.ConnectionInfo);
                this.connectionItems.Write();
                if (this.ConnectionItem == connectionItem)
                {
                    FirstFloor.ModernUI.Presentation.AppearanceManager.Current.AccentColor = connectionItem.ThemeColor;
                    FirstFloor.ModernUI.Presentation.AppearanceManager.Current.ThemeSource = themes[connectionItem.Theme];
                    this.SetPassword(this.ConnectionItem.Password, true);
                }
            }
        }