コード例 #1
0
 public void SetTrigger(Lazurite.MainDomain.TriggerBase trigger, Action callback = null)
 {
     StuckUILoadingWindow.Show(
         "Компоновка окна...",
         () =>
     {
         if (trigger != null)
         {
             _originalTrigger = trigger;
             _clonedTrigger   = (Lazurite.MainDomain.TriggerBase)Lazurite.Windows.Utils.Utils.CloneObject(_originalTrigger);
             _clonedTrigger.Initialize();
             buttonsView.SetTrigger(_clonedTrigger);
             IsModified                 = false;
             _constructorView           = new TriggerView(_clonedTrigger);
             _constructorView.Modified += () => Modified?.Invoke();
             _constructorView.Modified += () => buttonsView.TriggerModified();
             _constructorView.Modified += () => IsModified = true;
             _constructorView.Failed   += () => buttonsView.Failed();
             _constructorView.Succeed  += () => buttonsView.Success();
             contentPresenter.Content   = _constructorView;
             EmptyTriggerModeOff();
         }
         else
         {
             EmptyTriggerModeOn();
         }
         callback?.Invoke();
     }
         );
 }
コード例 #2
0
        private ItemView AddInternal(Lazurite.MainDomain.TriggerBase trigger)
        {
            var itemView = new ItemView();

            itemView.Content = TrimTriggerName(trigger.Name);
            itemView.Icon    = Icons.Icon.ChevronRight;
            itemView.Tag     = trigger;
            itemView.Margin  = new Thickness(0, 1, 0, 0);
            itemsView.Children.Add(itemView);
            tbTriggersEmpty.Visibility = Visibility.Collapsed;
            return(itemView);
        }
コード例 #3
0
 public void Revert()
 {
     _clonedTrigger = (Lazurite.MainDomain.TriggerBase)Lazurite.Windows.Utils.Utils.CloneObject(_originalTrigger);
     try
     {
         _clonedTrigger.Initialize();
     }
     catch (Exception e)
     {
         _log.ErrorFormat(e, "Во время инициализации триггера {0} возникла ошибка.", _clonedTrigger.Name);
     }
     buttonsView.Revert(_clonedTrigger);
     _constructorView.Revert(_clonedTrigger);
     IsModified = false;
 }
コード例 #4
0
        public void Refresh(Lazurite.MainDomain.TriggerBase trigger)
        {
            var itemView =
                itemsView
                .Children
                .Cast <ItemView>()
                .First(x => ((Lazurite.MainDomain.TriggerBase)x.Tag).Id.Equals(trigger.Id));

            if (itemView.Tag == SelectedTrigger)
            {
                SelectedTrigger = trigger;
            }

            itemView.Tag     = trigger;
            itemView.Content = TrimTriggerName(trigger.Name);
        }
コード例 #5
0
        public void Remove(Lazurite.MainDomain.TriggerBase trigger)
        {
            var itemView =
                itemsView
                .Children
                .Cast <ItemView>()
                .First(x => ((Lazurite.MainDomain.TriggerBase)x.Tag).Id.Equals(trigger.Id));

            itemsView.Children.Remove(itemView);
            if (itemsView.GetItems().Any())
            {
                itemsView.GetItems().First().Selected = true;
            }
            else
            {
                SelectedTrigger = null;
                SelectionChanged?.Invoke(null);
                tbTriggersEmpty.Visibility = Visibility.Collapsed;
            }
        }
コード例 #6
0
 private void btDeleteScenario_Click(object sender, RoutedEventArgs e)
 {
     MessageView.ShowYesNo("Вы уверены что хотите удалить выбранный триггер?", "Удаление триггера", Icon.ListDelete,
                           (result) => {
         if (result)
         {
             var trigger = triggersListView.SelectedTrigger;
             try
             {
                 _repository.RemoveTrigger(trigger);
                 _lastDeletedTrigger = trigger;
                 triggersListView.Remove(trigger);
             }
             catch (Exception exception)
             {
                 MessageView.ShowMessage(exception.Message, "Невозможно удалить триггер", Icon.Warning);
                 _warningHandler.Warn("Невозможно удалить триггер", exception);
             }
         }
     }
                           );
 }
コード例 #7
0
 private void TriggersList_SelectionChanged(Lazurite.MainDomain.TriggerBase obj)
 {
     constructorsResolver.SetTrigger(triggersListView.SelectedTrigger);
     btDeleteTrigger.Visibility = triggersListView.SelectedTrigger != null ? Visibility.Visible : Visibility.Collapsed;
 }
コード例 #8
0
 private void TriggersList_SelectionChanging(Lazurite.MainDomain.TriggerBase arg1, TriggerChangingEventArgs args)
 {
     ThroughTriggerSave(args.Apply);
 }
コード例 #9
0
 public void Add(Lazurite.MainDomain.TriggerBase trigger)
 {
     AddInternal(trigger).Selected = true;
 }
コード例 #10
0
 public abstract void SaveTrigger(TriggerBase trigger);
コード例 #11
0
 public abstract void RemoveTrigger(TriggerBase trigger);
コード例 #12
0
 public abstract void AddTrigger(TriggerBase trigger);