Ejemplo n.º 1
0
        public SettingsViewModel(INavigationService navigationService,
                                 ISettingsService settingsService,
                                 IWindowsServiceClient windowsServiceClient,
                                 ILoggerService loggingService)
            : base(navigationService)
        {
            _settingsService      = settingsService;
            _windowsServiceClient = windowsServiceClient;
            _loggingService       = loggingService;

            SelectedLocations = new ObservableCollection <Location>();
            DocumentTypes     = Enum.GetValues(typeof(DocumentType))
                                .OfType <DocumentType>()
                                .Select(x => Document.GetTypeTitle(x))
                                .OrderBy(x => x)
                                .ToList();
            PrintModes = Enum.GetValues(typeof(PrintMode))
                         .OfType <PrintMode>()
                         .Select(x => new KeyValuePair <PrintMode, string>(x, x.ToString()))
                         .ToList();

            MessengerInstance.Register <User>(this, OnUserChanged);

            UpdatePrinterCommand  = new RelayCommand <Printer>(OnUpdatePrinter);
            RestartServiceCommand = new RelayCommand(OnRestartService);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Vytvori instancie pluginov ktore su urcene na spustenie
        /// </summary>
        /// <param name="types">Typy pluginov ktore maju byt vytvorene</param>
        /// <returns>Kolekcia instancii</returns>
        private List <IWindowsServiceClient> InternalCreateInstance(List <Type> types)
        {
            List <IWindowsServiceClient> collection = new List <IWindowsServiceClient>();

            foreach (Type type in types)
            {
                try
                {
                    IWindowsServiceClient plugin = (IWindowsServiceClient)Activator.CreateInstance(type);
                    collection.Add(plugin);
                }
                catch (Exception ex)
                {
                    //zalogujeme
                    this.InternalTrace(TraceTypes.Error, "Initializing plugin {0} failed", type);
                    this.InternalTrace(ex);
                }
            }
            return(collection);
        }
Ejemplo n.º 3
0
        public JobsViewModel(INavigationService navigationService,
                             IWindowsServiceClient windowsServiceClient,
                             ILoggerService loggingService)
            : base(navigationService)
        {
            _windowsServiceClient = windowsServiceClient;
            _loggingService       = loggingService;

            JobStates = Enum.GetValues(typeof(JobState))
                        .OfType <JobState?>()
                        .Union(new[] { (JobState?)null })
                        .Select(x => new KeyValuePair <JobState?, string>(x, x.HasValue ? x.ToString() : "All"))
                        .ToList();
            DocumentTypes = Enum.GetValues(typeof(DocumentType))
                            .OfType <DocumentType?>()
                            .OrderBy(x => Document.GetTypeTitle(x.Value))
                            .Union(new[] { (DocumentType?)null })
                            .Select(x => new KeyValuePair <DocumentType?, string>(x, x.HasValue ? Document.GetTypeTitle(x.Value) : "All"))
                            .ToList();

            PrintCommand      = new RelayCommand <Job>(OnPrint);
            DeleteJobCommand  = new RelayCommand <Job>(OnDeleteJob);
            DeleteJobsCommand = new RelayCommand <DeleteJobAmount>(OnDeleteJobs);
        }