private ServiceConfiguration(INavigationService navigationService, IActionInvokerFactory invokerFactory, bool editMode) : base(editMode) { _navigationService = navigationService; _invokerFactory = invokerFactory; ActionGroups = new ObservableCollectionWithAddRange <ActionGroup>(); AddActionGroupCommand = new RelayCommand(() => { ActionGroups.Add(ActionGroup.CreateSilently("", this, _navigationService, EditMode)); NotifyThatSomethingIsChanged(); }); InvokeUriCommand = new RelayCommand <ServiceAction>(async action => { if (EditMode) { _navigationService.NavigateTo(ActionPage.Key, action); } else { action.Processing = true; Messenger.Default.Send(new ActionProcessingMessage()); ((RelayCommand <ServiceAction>)InvokeUriCommand).RaiseCanExecuteChanged(); await InvokeRestActionAsync(action); action.Processing = false; ((RelayCommand <ServiceAction>)InvokeUriCommand).RaiseCanExecuteChanged(); await Task.Delay(1000); //The spinner animation should run at least 1 second Messenger.Default.Send(new ActionCompletedMessage()); } }, action => action != null && !action.Processing); DeleteActionGroupCommand = new RelayCommand <ActionGroup>(group => { ActionGroups.Remove(group); NotifyThatSomethingIsChanged(); }); }
public SinLineViewModel() { LineDataPoints = new ObservableCollectionWithAddRange <DataPoint>(); NewDataPointsList1 = new ObservableCollection <DataPoint>(); NewDataPointsList2 = new ObservableCollection <DataPoint>(); GeneratedDataPointsList1 = new ObservableCollection <DataPoint>(); GeneratedDataPointsList2 = new ObservableCollection <DataPoint>(); StartStopCommand = new StartStopCommand(this); LoadGraphFromFileCommand = new LoadGraphFromFileCommand(this); UnloadGraphCommand = new UnloadGraphCommand(this); IsDataPointList1Active = true; IsNewDataPointList1Active = true; SaveToFileTimer = new Timer(new TimerCallback(SaveToFileTimerTick), null, Timeout.Infinite, Timeout.Infinite); AddPointsToGraphTimer = new Timer(new TimerCallback(AddPointsToGraphTimerTick), null, Timeout.Infinite, Timeout.Infinite); ManualResetEvent = new ManualResetEvent(false); CalcThread = new Thread(FomulaThread); CalcThread.IsBackground = true; CalcThread.Start(); }
private ServiceConfiguration(INavigationService navigationService, IActionInvokerFactory invokerFactory, bool editMode) : base(editMode) { _navigationService = navigationService; _invokerFactory = invokerFactory; ActionGroups = new ObservableCollectionWithAddRange<ActionGroup>(); AddActionGroupCommand = new RelayCommand(() => { ActionGroups.Add(ActionGroup.CreateSilently("", this, _navigationService, EditMode)); NotifyThatSomethingIsChanged(); }); InvokeUriCommand = new RelayCommand<ServiceAction>(async action => { if (EditMode) { _navigationService.NavigateTo(ActionPage.Key, action); } else { action.Processing = true; Messenger.Default.Send(new ActionProcessingMessage()); ((RelayCommand<ServiceAction>) InvokeUriCommand).RaiseCanExecuteChanged(); await InvokeRestActionAsync(action); action.Processing = false; ((RelayCommand<ServiceAction>) InvokeUriCommand).RaiseCanExecuteChanged(); await Task.Delay(1000); //The spinner animation should run at least 1 second Messenger.Default.Send(new ActionCompletedMessage()); } }, action => action != null && !action.Processing); DeleteActionGroupCommand = new RelayCommand<ActionGroup>(group => { ActionGroups.Remove(group); NotifyThatSomethingIsChanged(); }); }