Esempio n. 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();
     }
         );
 }
        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);
        }
Esempio n. 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;
 }
        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);
        }
        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;
            }
        }
 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);
             }
         }
     }
                           );
 }
 private void TriggersList_SelectionChanged(Lazurite.MainDomain.TriggerBase obj)
 {
     constructorsResolver.SetTrigger(triggersListView.SelectedTrigger);
     btDeleteTrigger.Visibility = triggersListView.SelectedTrigger != null ? Visibility.Visible : Visibility.Collapsed;
 }
 private void TriggersList_SelectionChanging(Lazurite.MainDomain.TriggerBase arg1, TriggerChangingEventArgs args)
 {
     ThroughTriggerSave(args.Apply);
 }
 public void Add(Lazurite.MainDomain.TriggerBase trigger)
 {
     AddInternal(trigger).Selected = true;
 }
 public abstract void SaveTrigger(TriggerBase trigger);
 public abstract void RemoveTrigger(TriggerBase trigger);
 public abstract void AddTrigger(TriggerBase trigger);