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 void Insert(ActionHolder actionHolder, int position = -1) { if (position == -1) { position = Children.Count; } var constructorElement = ActionControlResolver.Create(actionHolder, AlgorithmContext); var control = ((FrameworkElement)constructorElement); control.Margin = new Thickness(0, 1, 0, 0); constructorElement.Refresh(actionHolder, AlgorithmContext); constructorElement.Modified += (element) => Modified?.Invoke(element); constructorElement.NeedRemove += (element) => { _action.ActionHolders.Remove(actionHolder); Children.Remove(control); Modified?.Invoke(this); }; constructorElement.NeedAddNext += (element) => { SelectCoreActionView.Show((type) => { var index = Children.IndexOf(control) + 1; var newActionHolder = new ActionHolder() { Action = _manager.CreateInstance(type, AlgorithmContext) }; _action.ActionHolders.Insert(index, newActionHolder); Insert(newActionHolder, index); Modified?.Invoke(this); }); }; Children.Insert(position, control); }
public bool LoadSVG(string fileName) { SvgScraper svgScraper = new SvgScraper(); Size svgSize; try { SvgDocument svgDocument = SvgDocument.Open(fileName); svgSize = new Size(svgScraper.GetWidth(svgDocument), svgScraper.GetHeight(svgDocument)); svgDocument.Draw(svgScraper); } catch (Exception e) { Debug.WriteLine(e); return(false); } Drawing svgDrawing = svgScraper.CreateDrawing(new Rect(0.0, -svgSize.Height, svgSize.Width, svgSize.Height)); FileName = fileName; Drawing = svgDrawing; Size = svgSize; Modified?.Invoke(this, null); return(true); }
public void OnModified(bool newThread) { if (Modified != null) { Modified.Invoke(this, EventArgs.Empty); } }
private void DirectionLayout_DragDrop(object sender, DragEventArgs e) { if (_panel_to_add == null) { return; } if (e.Data.GetDataPresent("Frame") || e.Data.GetDataPresent("ImageFrame")) { // commit to the removal of the frame from the dragged_from direction: if (_panel_to_add.Parent != null) { DirectionLayout last_dir = ((DirectionLayout)_panel_to_add.Parent.Parent); last_dir._direction.Frames.RemoveAt(last_dir._direction.Frames.IndexOf(_panel_to_add.Frame)); } ImagesPanel.Controls.Add(_panel_to_add); Point Location = ImagesPanel.PointToClient(new Point(e.X, e.Y)); FramePanel place_panel = (FramePanel)ImagesPanel.GetChildAtPoint(Location); ImagesPanel.Controls.SetChildIndex(_panel_to_add, ImagesPanel.Controls.IndexOf(place_panel)); // and add the frame to the dragged_to direction: int pos = _direction.Frames.Count - (ImagesPanel.Controls.IndexOf(_panel_to_add)); _direction.Frames.Insert(pos, _panel_to_add.Frame); _panel_to_add = null; Invalidate(true); Modified?.Invoke(this, new EventArgs()); } }
public override void OnEndUpdate(ItemBase updatedAttribute) { Modified?.Invoke(this); // clear selected solutions while (_selectedSolutions.Count > 0) { UnSelectSolution(_selectedSolutions[0]); } // clear solutions _solutions.Clear(); // get default analysis solver if (null != _solver) { _solver.ProcessAnalysis(this); } else { _log.Error("_solver == null : solver was not set"); } if (_solutions.Count == 0) { _log.Debug("Recomputed analysis has no solutions"); } // set modified / propagate modifications Modify(); }
public void BeginEditAction() { try { ActionControlResolver.UserInitialize( (result) => { if (result) { Model.Refresh(ActionHolder); Modified?.Invoke(this); if (MasterAction != null && MasterAction.ValueType.GetType() != ActionHolder.Action.ValueType.GetType()) { MessageView.ShowMessage( "Тип действия не совпадает с типом главного действия. Нужно настроить подчиненное действие еще раз.", "Внимание!", Icons.Icon.WarningCircle, null, () => BeginEditAction() ); } } }, ActionHolder.Action, MasterAction?.ValueType, MasterAction != null, MasterAction); } catch (Exception e) { Log.Error("Ошибка во время настройки действия", e); } }
public void ClearActions() { _actionManager.Clear(); _dsmModel.ClearActions(); IsModified = true; Modified?.Invoke(this, IsModified); }
private void Initialize() { _actionView = new ActionView(); _actionView.Refresh(Scenario.ActionHolder, Scenario); _actionView.Modified += (element) => Modified?.Invoke(); gridContent.Children.Add(_actionView); }
public FileChangeWatcherExcludeFirst(string path) { var fileInfo = new FileInfo(path); Watcher = new FileSystemWatcher(fileInfo.DirectoryName ?? throw new InvalidOperationException()) { Filter = fileInfo.Name, NotifyFilter = NotifyFilters.LastWrite, IncludeSubdirectories = false }; void OnModified(object sender, FileSystemEventArgs args) { if (_ignoreFirst) { _ignoreFirst = false; } else { Modified?.Invoke(sender, args); } } Watcher.Created += OnModified; Watcher.Changed += OnModified; Watcher.EnableRaisingEvents = true; }
public virtual void UpdateProperty(Guid id, string propertyName, object value) { Modified.Invoke(); throw new NotImplementedException("Method " + MethodBase.GetCurrentMethod().Name + " in " + MethodBase.GetCurrentMethod().DeclaringType .ToString() + " not implemented."); }
/*************************************/ protected void MarkAsModified(CallerUpdate update) { if (Modified != null) { Modified?.Invoke(this, update); } }
protected virtual void OnModified(object sender, StreamCollectionEventArgs streamCollectionEventArgs) { var result = streamCollectionEventArgs.To <T>(); var modificationType = streamCollectionEventArgs.ModificationType; Modified?.Invoke(this, new TypedStreamCollectionEventArgs <T>(result, modificationType)); }
public async Task SaveModel(string dsmFilename, Progress <ProgressInfo> progress) { _actionStore.SaveToModel(); await Task.Run(() => _dsmModel.SaveModel(dsmFilename, _dsmModel.IsCompressed, progress)); IsModified = false; Modified?.Invoke(this, IsModified); }
public async Task OpenModel(string dsmFilename, Progress <ProgressInfo> progress) { await Task.Run(() => _dsmModel.LoadModel(dsmFilename, progress)); _actionStore.LoadFromModel(); IsModified = false; Modified?.Invoke(this, IsModified); }
private void OnModified(ModificationEventArgs e) { if (!loading) { isDirty = true; Modified?.Invoke(this, e); } }
/// <summary> /// Marks the context as modified and sends the event to the parent context. /// </summary> /// <param name="graphEdited">True if graph has been edited (nodes structure or parameter value). Otherwise just UI elements has been modified (node moved, comment resized).</param> public void MarkAsModified(bool graphEdited = true) { _isModified = true; Modified?.Invoke(this, graphEdited); Parent?.MarkAsModified(graphEdited); }
private void OnModified(EventArgs e) { if (!Loading) { IsDirty = true; Modified?.Invoke(this, e); } }
public ReturnScenarioValueView() { InitializeComponent(); action2View.Modified += (element) => Modified?.Invoke(this); buttons.RemoveClick += () => NeedRemove?.Invoke(this); buttons.AddNewClick += () => NeedAddNext?.Invoke(this); action1View.MakeButtonsInvisible(); }
public new void AddRange(IEnumerable <DialogButton> collection) { base.AddRange(collection); if (Modified != null) { Modified.Invoke(this, new EventArgs()); } }
/// <summary> /// Raises the <see cref="SignalboxHoursModified" /> event. /// </summary> /// <param name="signalboxHours">The object which has been modified.</param> protected virtual void OnSignalboxHoursModified(SignalboxHours signalboxHours) { SignalboxHoursModified?.Invoke(this, new SignalboxHoursEventArgs { SignalboxHours = signalboxHours }); Modified?.Invoke(this, new ModifiedEventArgs { ModifiedItem = this }); }
/// <summary> /// Invokes the <see cref="ExecutionReportModified"/> delegate. /// </summary> /// <param name="message">The message.</param> /// <param name="entry">The report entry <see cref="ReportEntry"/>.</param> private void RaiseModified(string message, ReportEntry entry) { Modified?.Invoke(this, new[] { new ExecutionReportModifiedArgs { Message = message, ReportEntry = entry } }); }
public new void Remove(DialogButton button) { base.Remove(button); if (Modified != null) { Modified.Invoke(this, new EventArgs()); } }
public CheckerOperatorPairView() { InitializeComponent(); operatorView.Modified += (e) => Modified?.Invoke(this); actionView.Modified += (e) => Modified?.Invoke(this); actionView.NeedAddNext += (e) => NeedAddNext?.Invoke(this); actionView.NeedRemove += (e) => NeedRemove?.Invoke(this); }
/// <summary> /// Sets a setting. /// </summary> /// <param name="name">Name of the setting.</param> /// <param name="value">Value of the setting. Must be serializable to JSON.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="name"/> is null.</exception> public void SetSetting(string name, object value) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } Settings[name] = value; Modified?.Invoke(this, new EventArgs()); }
public void SetFromSRTMatrix(Vector3 localPosition, Quaternion localRotation, Vector3 localScale) { _isSRTMatrix = true; _srtLocalPosition = localPosition; _srtLocalRotation = localRotation; _srtLocalScale = localScale; _isCachedSRTLocalMatrixUpToDate = false; _isCachedRTLocalMatrixUpToDate = false; Modified?.Invoke(this, new EventArgs()); }
public void ResetAsSRTMatrix() { _isSRTMatrix = true; _srtLocalPosition = Vector3.Zero; _srtLocalRotation = Quaternion.Identity; _srtLocalScale = Vector3.One; _isCachedSRTLocalMatrixUpToDate = false; _isCachedRTLocalMatrixUpToDate = false; Modified?.Invoke(this, new EventArgs()); }
public ComplexCheckerOperatorPairView() { InitializeComponent(); operatorView.Modified += (e) => Modified?.Invoke(this); complexCheckerView.Modified += (e) => Modified?.Invoke(this); buttonsEnd.AddNewClick += () => NeedAddNext?.Invoke(this); buttonsGroup.RemoveClick += () => NeedRemove?.Invoke(this); buttonsGroup.AddNewClick += () => complexCheckerView.AddFirst(); }
public WhileActionView() { InitializeComponent(); buttonsEnd.AddNewClick += () => NeedAddNext?.Invoke(this); buttonsWhile.RemoveClick += () => NeedRemove?.Invoke(this); buttonsDo.AddNewClick += () => actionView.AddFirst(); buttonsWhile.AddNewClick += () => checkerView.AddFirst(); actionView.Modified += (e) => Modified?.Invoke(this); checkerView.Modified += (e) => Modified?.Invoke(this); }
private void Delete() { var result = MessageBox.Show("Are you sure you wish to delete this tab? This action cannot be undone.", null, MessageBoxButton.YesNo, MessageBoxImage.Exclamation); if (result != MessageBoxResult.Yes) { return; } Modified?.Invoke(this, ParentTab); DeleteTab?.Invoke(this, ParentTab); }