Example #1
0
        public DeveloperListViewModel(IEventAggregator eventAggregator, IBusyIndicator busyIndicator)
        {
            _eventAggregator = eventAggregator;
            _busyIndicator   = busyIndicator;

            _deleteCommand    = new DelegateCommand <DeveloperModel>(async(item) => await DeleteModel(item));
            _refreshCommand   = new DelegateCommand(async() => await LoadData());
            _filterCommand    = new DelegateCommand(async() => await ExecuteFilter(), CanExecuteFilter);
            _cloneCommand     = new DelegateCommand <DeveloperModel>(async(model) => await CloneModel(model));
            _deleteAllCommand = new DelegateCommand(async() => await DeleteAllModel(), CanDeleteAll);
            _simulateCommand  = new DelegateCommand(async() => await Simulate());
            _eventAggregator.GetEvent <UpdateDeveloperListPubEvent>().Subscribe(async() =>
            {
                await LoadData();
            });

            //Queue to reacte when a user is saved or changed
            async void userChangedCallback(string payload, string severity) => await UserChangedCallback(payload, severity);

            _userChangedQueueClient = new QueueClient(QueueConfig.ExchangeUser, QueueConfig.SeverityUser, userChangedCallback);


            //Queue to reacte when multiple users are saved
            void usersSavedCallback(string payload, string severity) => UsersSavedCallback(payload, severity);

            _usersSavedQueueClient = new QueueClient(QueueConfig.ExchangeUser, QueueConfig.SeverityMultipleUsers, usersSavedCallback);
        }
Example #2
0
        public static void ShowBusy(this IBusyIndicator @this, string message = null)
        {
            if (@this == null)
            {
                return;
            }

            @this.IsBusy      = true;
            @this.BusyMessage = message;
        }
Example #3
0
        public static void HideBusy(this IBusyIndicator @this)
        {
            if (@this == null)
            {
                return;
            }

            @this.BusyMessage = string.Empty;
            @this.IsBusy      = false;
        }
 public DeleteTask(
     Task task, 
     TasksService tasksService,
     DataContext dataContext, 
     IBusyIndicator busyIndicator)
 {
     _task = task;
     _tasksService = tasksService;
     _dataContext = dataContext;
     _busyIndicator = busyIndicator;
 }
 public LoadTasks(
     string tasksListsId,
     DataContext dataContext,
     TasksService tasksService,
     IBusyIndicator busyIndicator)
 {
     _tasksListsId = tasksListsId;
     _dataContext = dataContext;
     _tasksService = tasksService;
     _busyIndicator = busyIndicator;
 }
 public LogoutAndExit(
     IContainer container,
     AuthorizationManager authorizationManager,
     IBusyIndicator busyIndicator, 
     DataContext dataContext)
 {
     _container = container;
     _authorizationManager = authorizationManager;
     _busyIndicator = busyIndicator;
     _dataContext = dataContext;
 }
 public EditTasksList(
     TaskList tasksList, 
     TasksService tasksService, 
     IBusyIndicator busyIndicator, 
     DataContext dataContext)
 {
     _tasksList = tasksList;
     _tasksService = tasksService;
     _busyIndicator = busyIndicator;
     _dataContext = dataContext;
 }
Example #8
0
 public EditFormViewModel(
     INotificationManager notificationManager,
     IEventAggregator eventAggregator,
     IRequestManager requestManager,
     IWindowManager windowManager,
     IBusyIndicator busyIndicator,
     ICache cache)
 {
     this.busyIndicator       = busyIndicator;
     this.windowManager       = windowManager;
     this.requestManager      = requestManager;
     this.notificationManager = notificationManager;
     this.eventAggregator     = eventAggregator;
     this.eventAggregator.Subscribe(this);
     EditedForm = new EditedFormDataModel();
     EditedForm.KeyFormTypes = cache.GetKeyFormTypes().ToList();
 }
Example #9
0
        public ManageFormsViewModel(
            IWindowManager windowManager,
            IBusyIndicator busyIndicator,
            IRequestManager requestManager,
            IEventAggregator eventAggregator,
            INotificationManager notificationManager)
        {
            this.eventAggregator = eventAggregator;
            this.eventAggregator.Subscribe(this);
            this.notificationManager = notificationManager;
            this.windowManager       = windowManager;
            this.requestManager      = requestManager;
            BusyIndicator            = busyIndicator;

            ChkBankIsActive = false;
            formFilter      = new FormFilter();
            FormModels      = new BindableCollection <FormModel>();
        }
Example #10
0
 public ManageOwnersViewModel(
     IRequestManager requestManager,
     IWindowManager windowManager,
     INotificationManager notificationManager,
     IEventAggregator eventAggregator,
     IMappingManager mappingManager,
     IBusyIndicator busyIndicator)
 {
     this.mappingManager      = mappingManager;
     this.windowManager       = windowManager;
     this.eventAggregator     = eventAggregator;
     this.requestManager      = requestManager;
     this.notificationManager = notificationManager;
     BusyIndicator            = busyIndicator;
     ownerFilter = new OwnerModelFilter();
     DisplayName = Resources.HeaderEditBank;
     Owners      = new BindableCollection <OwnerDataModel>();
 }
Example #11
0
        public DeveloperViewModel(IEventAggregator eventAggregator, IBusyIndicator busyIndicator,
                                  IKnowledgeRepository knowledgeRepository)
        {
            _busyIndicator   = busyIndicator;
            _eventAggregator = eventAggregator;

            _saveCommand            = new DelegateCommand(async() => await Save(), CanExecuteSave);
            _cancelCommand          = new DelegateCommand(Cancel);
            _addKnowledgeCommand    = new DelegateCommand(OpenKnowledgeEditor, CanOpenKnowledgeEditor);
            _removeKnowledgeCommand = new DelegateCommand <KnowledgeModel>(item => RemoveKnowledge(item));

            _interactionRequest = new InteractionRequest <Confirmation>();

            Developer    = new DeveloperModel();
            SeletedIndex = 0;

            _eventAggregator.GetEvent <EntityEditPubEvent>().Subscribe(data => SetCurrentModel(data));
            _eventAggregator.GetEvent <AddKnowledgePubEvent>().Subscribe(data => AddKnowledge(data));
        }
        public static void RunWorker(this IBusyIndicator @this, Action <BackgroundWorker> doWorkAction,
                                     Action <int, object> reportAction = null)
        {
            var w = new BackgroundWorker {
                WorkerReportsProgress = true, WorkerSupportsCancellation = true
            };

            w.DoWork += (s, e) => doWorkAction.Invoke(w);

            w.ProgressChanged += (s, e) =>
            {
                @this.ShowBusy($"{e.ProgressPercentage} {e.UserState}");
                reportAction?.Invoke(e.ProgressPercentage, e.UserState);
            };

            w.RunWorkerCompleted += (s, e) =>
            {
                @this.HideBusy();
                ((BackgroundWorker)s).Dispose();
            };
            w.RunWorkerAsync();
        }
Example #13
0
        public void Run()
        {
            try
            {
                IDevice device = SelectDevice();

                deviceConnector.UseDevice(device);

                IDirectory rootDirectory;
                using (IBusyIndicator busyIndicator = interactor.SetBusy())
                {
                    rootDirectory = deviceConnector.ReadMetadataOfAllFiles();
                }

                IFileOperation operation = interactor.CreateFileOperation(rootDirectory);

                using (IBusyIndicator busyIndicator = interactor.SetBusy())
                {
                    Execute(operation);
                }

                interactor.NotifySuccess(operation);
            }
            catch (NoDeviceConnectedException)
            {
                interactor.NotifyNoDeviceConnected();
            }
            catch (NoDeviceSelectedException)
            {
                interactor.NotifyNoDeviceSelected();
            }
            catch (ExecutionFailedException ex)
            {
                interactor.NotifyFileOperationFailed(ex.Message);
            }
        }
Example #14
0
        public IBusyResult In(IBusyIndicator busyIndicator)
        {
            _locateBusyIndicator = x => busyIndicator;

            return(this);
        }
Example #15
0
 public BecomeBusy(IBusyIndicator busyIndicator)
 {
     _busyIndicator = busyIndicator;
 }
Example #16
0
 public RemoteOperationManager(IBusyIndicator busyIndicator, IErrorNotifier errorNotifier)
 {
     _busyIndicator = busyIndicator ?? throw new ArgumentNullException(nameof(busyIndicator));
     _errorNotifier = errorNotifier ?? throw new ArgumentNullException(nameof(errorNotifier));
 }
Example #17
0
 public BecomeIdle(IBusyIndicator busyIndicator)
 {
     _busyIndicator = busyIndicator;
 }
Example #18
0
 /// <summary>
 /// Событие, вызывается при изменении свойства BusyIndicator.
 /// </summary>
 protected virtual void OnBusyIndicatorChanged(IBusyIndicator oldValue, IBusyIndicator newValue)
 {
 }
Example #19
0
 public ShellViewModel(IBusyIndicator busyIndicator, ApplicationViewModel application)
 {
     _busyIndicator = busyIndicator;
     _application   = application;
     Items.AddRange(new object[] { _busyIndicator, _application });
 }
 public ChildScreenViewModel(IBusyIndicator busyIndicator, IEventAggregator eventAggregator)
 {
     _busyIndicator   = busyIndicator;
     _eventAggregator = eventAggregator;
     _eventAggregator.Subscribe(this);
 }
Example #21
0
 public PopupService(INavigationRoot navigationRoot, IBusyIndicator busyIndicator)
 {
     _navigationRoot = navigationRoot;
     _busyIndicator  = busyIndicator;
 }
 public BusyScope(IBusyIndicator busyIndicator)
 {
     _busyIndicator = busyIndicator;
     _busyIndicator.IsBusy = true;
 }