public ServiceUC(EventHandler onRemove, SystemServiceViewModel systemServiceViewModel)
 {
     InitializeComponent();
     _onRemove = onRemove;
     _systemServiceViewModel = systemServiceViewModel;
     SetServiceValues();
 }
 public ServiceDetailWindow(SystemServiceViewModel systemServiceView,
                            ItemsMonitoringService itemsMonitoringService)
 {
     InitializeComponent();
     _systemServiceView      = systemServiceView;
     _itemsMonitoringService = itemsMonitoringService;
     Populate();
 }
示例#3
0
 public void LoadFromService(SystemServiceViewModel systemService)
 {
     DataContext = new
     {
         Service = systemService,
         UAC     = new UserAccountControlViewModel(),
     };
 }
示例#4
0
        public void SetServiceValues(SystemServiceViewModel systemServiceViewModel)
        {
            _systemServiceViewModel    = systemServiceViewModel;
            this.lblDisplayName.Text   = _systemServiceViewModel.GetDisplayNameFormated();
            this.lblCurrentStatus.Text = _systemServiceViewModel.Value;
            this.lblServiceName.Text   = _systemServiceViewModel.GetNameFormated();
            this.lblMonitoredAt.Text   = _systemServiceViewModel.MonitoredAt;

            ChangeColorTextBlock(this.lblCurrentStatus);
        }
示例#5
0
        public ServiceUC(EventHandler onRemove, EventHandler onEdit, EventHandler onRestart,
                         SystemServiceViewModel systemServiceViewModel, UserBasicInformationViewModel userBasicInformation)
        {
            InitializeComponent();
            _onRemove             = onRemove;
            _onEdit               = onEdit;
            _onRestart            = onRestart;
            _userBasicInformation = userBasicInformation;

            if (_userBasicInformation.UserLevel < (int)EUserLevel.Admin)
            {
                btnRestart.IsEnabled  = btnDel.IsEnabled = false;
                btnRestart.Visibility = btnDel.Visibility = Visibility.Collapsed;
            }

            SetServiceValues(systemServiceViewModel);
        }
        private async void OnRemove(object sender, EventArgs e)
        {
            SystemServiceViewModel serviceViewModel = sender as SystemServiceViewModel;

            if (MessageBox.Show($"Deseja realmente remover o serviço: {serviceViewModel.DisplayName} do monitoramento?", "Atênção", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                var removeCallback = await _itemsMonitoringService.Delete(_agentId, serviceViewModel.Id);

                if (removeCallback.IsSuccess)
                {
                    MessageBox.Show($"Removido com sucesso", "Sucesso", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show($"Falha na tentativa de remoção.", "Falha", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
        }
        private void OnRemove(object sender, EventArgs e)
        {
            SystemServiceViewModel serviceViewModel = sender as SystemServiceViewModel;

            if (MessageBox.Show($"Deseja realmente remover o serviço: {serviceViewModel.DisplayName} do monitoramento?", "Atenção", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                _itemsMonitoringService.Delete(_agentId, serviceViewModel.Id).ContinueWith(task =>
                {
                    if (task.Result.IsSuccess)
                    {
                        MessageBox.Show($"Removido com sucesso", "Sucesso", MessageBoxButton.OK, MessageBoxImage.Information);
                        _indexes.Remove(serviceViewModel.Id);
                        PopulateByDictionary();
                    }
                    else
                    {
                        MessageBox.Show($"Falha na tentativa de remoção.", "Falha", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
        }
示例#8
0
        public MainWindow()
        {
            InitializeComponent();

            _service =
                new SystemServiceViewModel(new SystemService(_serviceName, _serviceAssemblyLocation))
            {
                Description      = Properties.Resources.ServiceDescription,
                DisplayName      = Properties.Resources.ServiceDisplayName,
                ServiceStartMode = Properties.Settings.Default.ServiceStartMode,
                Account          = Properties.Settings.Default.ServiceAccount
            };

            SystemServiceManagerControl.LoadFromService(_service);

            _systemTrayApplication = new SystemTrayApplicationViewModel {
                Icon = Properties.Resources.watchmen_ico, MinimiseOnClose = Properties.Settings.Default.MinimiseOnClose
            };
            Initialise(_systemTrayApplication);
            _watchFolderServices = new WatchFolderServicesViewModel();
            WatchFolderServiceControl.WatchFolderServices        = _watchFolderServices;
            WatchFolderTraySettingsControl.SystemTrayApplication = _systemTrayApplication;
        }