示例#1
0
        public void ClientsEditClick(FahClientSettingsPresenterFactory presenterFactory)
        {
            var selectedSlot = GridModel.SelectedSlot;

            if (selectedSlot == null)
            {
                return;
            }

            var client           = ClientConfiguration.Get(selectedSlot.Settings.Name);
            var originalSettings = client.Settings;

            Debug.Assert(originalSettings.ClientType == ClientType.FahClient);

            var model = new FahClientSettingsModel(originalSettings);

            using (var dialog = presenterFactory.Create(model))
            {
                while (dialog.ShowDialog(Form) == DialogResult.OK)
                {
                    var newSettings = dialog.Model.ClientSettings;
                    // perform the edit
                    try
                    {
                        ClientConfiguration.Edit(originalSettings.Name, newSettings);
                        break;
                    }
                    catch (ArgumentException ex)
                    {
                        Logger.Error(ex.Message, ex);
                        MessageBox.ShowError(Form, ex.Message, Core.Application.NameAndVersion);
                    }
                }
            }
        }
示例#2
0
 // Clients Menu Handling Methods
 public void ClientsAddClick(FahClientSettingsPresenterFactory presenterFactory)
 {
     using (var dialog = presenterFactory.Create(new FahClientSettingsModel()))
     {
         while (dialog.ShowDialog(Form) == DialogResult.OK)
         {
             var settings = dialog.Model.ClientSettings;
             try
             {
                 ClientConfiguration.Add(settings);
                 break;
             }
             catch (ArgumentException ex)
             {
                 Logger.Error(ex.Message, ex);
                 MessageBox.ShowError(Form, ex.Message, Core.Application.NameAndVersion);
             }
         }
     }
 }