Пример #1
0
        public SystemManagerViewModel(ITSystem system = null)
        {
            if (system == null)
            {
                this.Itsystem     = new ITSystem();
                this.IsNewSystemg = true;
            }
            else
            {
                Itsystem = system;
            }

            Itsystem.SysAdministrator.ForEach(SysAdmin.Add);
            Itsystem.Alias.ForEach(Alias.Add);


            AddAliasCommand = new RelayCommand <string>(
                ExecuteAddAliasCommand);
            DeleteAliasCommand = new RelayCommand <string>(this.ExecuteDeleteAliasCommand);

            AddSysAdminCommand = new RelayCommand <string>(
                ExecuteAddSysAdminCommand);
            DeleteSysAdminCommand = new RelayCommand <string>(this.ExecuteDeleteSysAdminCommand);


            CloseCommand = new RelayCommand(() => MessengerInstance.Send <Tuple <ITSystem, bool> >(new Tuple <ITSystem, bool>(null, false)));

            ConfirmCommand = new RelayCommand(() => MessengerInstance.Send <Tuple <ITSystem, bool> >(new Tuple <ITSystem, bool>(Itsystem, this.IsNewSystemg)));
        }
Пример #2
0
 private void ExecuteEditCommand(ITSystem system)
 {
     DialogHost.Show(
         new SystemManagerView {
         DataContext = new SystemManagerViewModel(system)
     },
         (sender, args) =>
     {
         Console.WriteLine(
             ((args.Content as SystemManagerView).DataContext as SystemManagerViewModel).Itsystem);
     });
 }
Пример #3
0
 public void Update(Action <bool, Exception> callback, ITSystem systemToUpdate)
 {
     try
     {
         this.systemApi.Update(systemToUpdate);
     }
     catch (Exception ex)
     {
         callback(false, ex);
     }
     callback(true, null);
 }
Пример #4
0
 public void Insert(Action <bool, Exception> callback, ITSystem SystemToSave)
 {
     try
     {
         this.systemApi.Insert(SystemToSave);
     }
     catch (Exception ex)
     {
         callback(false, ex);
     }
     callback(true, null);
 }
Пример #5
0
 public void Delete(Action <bool, Exception> callback, ITSystem systemToDelete)
 {
     try
     {
         systemApi.Delete(systemToDelete);
     }
     catch (Exception ex)
     {
         callback(false, ex);
     }
     callback(true, null);
 }
Пример #6
0
 public void Update(Action <bool, Exception> callback, ITSystem listToSave)
 {
     throw new NotImplementedException();
 }
Пример #7
0
 private void DeleteSystem(ITSystem obj)
 {
     this._dataService.Delete(((b, exception) => Console.WriteLine(b)), obj);
     ListOfSystems.Remove(obj);
 }