Esempio n. 1
0
        public TestViewModelA(
            IEnumerable <ISomeFancyProvider> fancyProviders,
            IMessageBoxProvider messageBoxProvider,
            IPickerAdapter pickerAdapter,
            IDataCache dataCache,
            INavigationManager <PageIndex> navigationManager,
            ICustomDialogsManager <DialogIndex> dialogsManager,
            AppVariables appVariables)
        {
            _fancyProviders     = fancyProviders.ToList();
            _messageBoxProvider = messageBoxProvider;
            _pickerAdapter      = pickerAdapter;
            _navigationManager  = navigationManager;
            _dialogsManager     = dialogsManager;
            _appVariables       = appVariables;

            ShowLastFanciedThingCommand = new RelayCommand(
                async() =>
            {
                var data = await _appVariables.UserResponse.GetAsync();
                await _messageBoxProvider.ShowMessageBoxOkAsync(
                    "The thing you fancy!",
                    $"You fancied: {_appVariables.UserResponse.Value.FancyThing}\nAt {_appVariables.UserResponse.Value.DateTime}",
                    "Yeah, that's fancy.");
            }, () => UserResponse != null);
        }
 public BrowserViewModel(IAssemblyMetadataExtractor assemblyMetadataExtractor, IDataStorage dataStorage, ILogger logger, IMessageBoxProvider messageBoxProvider)
 {
     _assemblyMetadataExtractor = assemblyMetadataExtractor;
     _dataStorage        = dataStorage;
     _logger             = logger;
     _messageBoxProvider = messageBoxProvider;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EducationDialogViewModel"/> class.
 /// </summary>
 /// <param name="unitOfWork">Unit of work.</param>
 /// <param name="messageBoxProvider">Message box provider.</param>
 public EducationDialogViewModel(
     IUnitOfWork unitOfWork,
     IMessageBoxProvider messageBoxProvider)
 {
     this.unitOfWork         = unitOfWork;
     this.messageBoxProvider = messageBoxProvider;
 }
Esempio n. 4
0
 public PrepareDataViewModel(IOpenFileDialogProvider openFileDialogProvider, IMessageBoxProvider messageBoxProvider)
 {
     _openFileDialogProvider  = openFileDialogProvider;
     _messageBoxProvider      = messageBoxProvider;
     _stringToNumberConverter = new StringToNumberConverter();
     DataObjects = new List <DataObject>();
 }
Esempio n. 5
0
        public MainViewModel(IMessageBoxProvider messageBoxProvider)
        {
            this.messageBoxProvider = messageBoxProvider;
            states = new List <MachineState>
            {
                new MachineState {
                    Name = "q0"
                },
                new MachineState {
                    Name = "q1"
                },
                new MachineState {
                    Name = "q2"
                },
                new MachineState {
                    Name = "q3"
                },
                new MachineState {
                    Name = "q4"
                },
                new MachineState {
                    Name = "q5"
                },
                new MachineState {
                    Name = "q6"
                },
                new MachineState {
                    Name = "q7"
                },
                new MachineState {
                    Name = "q8"
                },
                new MachineState {
                    Name = "q9"
                },
                new MachineState {
                    Name = "q10"
                },
            };
            currentTape  = new ObservableCollection <string>();
            initSymbol   = "•";
            emptySymbol  = "β";
            currentState = initialState = states.First();
            finalState   = states.Last();

            //if (IsInDesignMode)
            {
                // Code runs in Blend --> create design time data.
                Tape        = new[] { "a", "a", "a", "b", "b", "c", "c", "c", "d" };
                Alphabet    = new[] { "a", "b", "c", "d" };
                AuxAlphabet = new[] { "A", "B", "C", "D" };
                //CurrentTapeSelectionIndex = 1;
                //CurrentTape = new ObservableCollection<string>(tape);
            }
            OnRunAll        = new RelayCommand(RunAll);
            OnRunStepByStep = new RelayCommand(RunStepByStep);
            OnClear         = new RelayCommand(Clear);
            OnReset         = new RelayCommand(Reset);
        }
Esempio n. 6
0
        public AlgorithmChoiceViewModel(IMessageBoxProvider messageBoxProvider)
        {
            _messageBoxProvider = messageBoxProvider;

            KindOfAlgorithms  = EnumHelper.GetAllValuesAndDescriptions <KindOfAlgorithm>();
            SelectedAlgorithm = KindOfAlgorithms.FirstOrDefault(e => e.Key == KindOfAlgorithm.Genetic.ToString());

            Messenger.Default.Register <IndividualLengthMessage>(this, SetIndividualLength);
        }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppointmentDialogViewModel"/> class.
 /// </summary>
 /// <param name="unitOfWork">Unit of work.</param>
 /// <param name="resourceHandler">Resource handler.</param>
 /// <param name="messageBoxProvider">Message box provider.</param>
 public AppointmentDialogViewModel(
     IUnitOfWork unitOfWork,
     IResourceHandler resourceHandler,
     IMessageBoxProvider messageBoxProvider)
 {
     this.unitOfWork         = unitOfWork;
     this.resourceHandler    = resourceHandler;
     this.messageBoxProvider = messageBoxProvider;
 }
Esempio n. 8
0
        public static void Import(IProgressMonitor monitor,
                                  String importFileName, String targetFileName,
                                  bool silent, IMessageBoxProvider messageBoxProvider,
                                  System.Action <Exception, bool> dataLoaded)
        {
            Importer importer = new Importer();

            importer.DoImport(monitor, importFileName, targetFileName, silent, messageBoxProvider, dataLoaded);
        }
Esempio n. 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationTemplateDialogViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        /// <param name="mode">The mode.</param>
        /// <param name="model">Notification template model.</param>
        public NotificationTemplateDialogViewModel(
            IUnitOfWork unitOfWork,
            IMessageBoxProvider messageBoxProvider,
            WorkModeType mode,
            NotificationTemplateModel model = null)
            : base(mode)
        {
            this.unitOfWork         = unitOfWork;
            this.messageBoxProvider = messageBoxProvider;

            Task.Factory.StartNewWithDefaultCulture(() => this.Load(model));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingDialogViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        /// <param name="applicationSettings">Application settings.</param>
        /// <param name="cultureCache">Culture cache.</param>
        public SettingDialogViewModel(
            IUnitOfWork unitOfWork,
            IMessageBoxProvider messageBoxProvider,
            IApplicationSettings applicationSettings,
            ICultureCache cultureCache)
        {
            this.unitOfWork          = unitOfWork;
            this.messageBoxProvider  = messageBoxProvider;
            this.applicationSettings = applicationSettings;
            this.cultureCache        = cultureCache;

            Task.Factory.StartNewWithDefaultCulture(() => this.Load(null));
        }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationInValidateDialogEmailViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="resourceHandler">Resource handler.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        public NotificationInValidateDialogEmailViewModel(
            IUnitOfWork unitOfWork,
            IResourceHandler resourceHandler,
            IMessageBoxProvider messageBoxProvider)
        {
            this.unitOfWork         = unitOfWork;
            this.resourceHandler    = resourceHandler;
            this.messageBoxProvider = messageBoxProvider;

            this.Model = new InvalidateEmailModel
            {
                Amount = 0
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EducationViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="viewModelBuilder">View model builder.</param>
        /// <param name="viewBuilder">View builder.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        /// <param name="educationCache">Education cache.</param>
        public EducationViewModel(
            IUnitOfWork unitOfWork,
            IViewModelBuilder viewModelBuilder,
            IViewBuilder viewBuilder,
            IMessageBoxProvider messageBoxProvider,
            IEducationCache educationCache)
        {
            this.unitOfWork         = unitOfWork;
            this.viewModelBuilder   = viewModelBuilder;
            this.viewBuilder        = viewBuilder;
            this.messageBoxProvider = messageBoxProvider;
            this.educationCache     = educationCache;

            Task.Factory.StartNewWithDefaultCulture(this.UpdateData);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationGroupDialogViewModel"/> class.
 /// </summary>
 /// <param name="unitOfWork">Unit of work.</param>
 /// <param name="viewModelBuilder">View model builder.</param>
 /// <param name="viewBuilder">View builder.</param>
 /// <param name="resourceHandler">Resource handler.</param>
 /// <param name="messageBoxProvider">Message box provider.</param>
 /// <param name="emailDeliveryService">Email delivery service.</param>
 public NotificationGroupDialogViewModel(
     IUnitOfWork unitOfWork,
     IViewModelBuilder viewModelBuilder,
     IViewBuilder viewBuilder,
     IResourceHandler resourceHandler,
     IMessageBoxProvider messageBoxProvider,
     IEmailDeliveryService emailDeliveryService)
 {
     this.unitOfWork           = unitOfWork;
     this.viewModelBuilder     = viewModelBuilder;
     this.viewBuilder          = viewBuilder;
     this.resourceHandler      = resourceHandler;
     this.messageBoxProvider   = messageBoxProvider;
     this.emailDeliveryService = emailDeliveryService;
 }
Esempio n. 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="eventAggregator">Event aggregator.</param>
        /// <param name="viewModelBuilder">View model builder.</param>
        /// <param name="viewBuilder">View builder.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        public PatientViewModel(
            IUnitOfWork unitOfWork,
            IEventAggregator eventAggregator,
            IViewModelBuilder viewModelBuilder,
            IViewBuilder viewBuilder,
            IMessageBoxProvider messageBoxProvider)
        {
            this.unitOfWork         = unitOfWork;
            this.eventAggregator    = eventAggregator;
            this.viewModelBuilder   = viewModelBuilder;
            this.viewBuilder        = viewBuilder;
            this.messageBoxProvider = messageBoxProvider;

            Task.Factory.StartNewWithDefaultCulture(this.UpdateData);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationListManageDialogViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        /// <param name="id">Identification of the notification group.</param>
        public NotificationListManageDialogViewModel(
            IUnitOfWork unitOfWork,
            IMessageBoxProvider messageBoxProvider,
            int id = 0)
        {
            this.unitOfWork         = unitOfWork;
            this.messageBoxProvider = messageBoxProvider;

            this.Id = id;

            this.notifications = new List <NotificationListModel>();
            this.domains       = new List <string>();

            Task.Factory.StartNewWithDefaultCulture(this.Load);
        }
Esempio n. 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LoginDialogViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="resourceHandler">Resource handler.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        /// <param name="roleCache">Role cache.</param>
        /// <param name="mode">Mode (Add/Edit).</param>
        /// <param name="model">Login model.</param>
        public LoginDialogViewModel(
            IUnitOfWork unitOfWork,
            IResourceHandler resourceHandler,
            IMessageBoxProvider messageBoxProvider,
            IRoleCache roleCache,
            WorkModeType mode,
            LoginModel model = null)
            : base(mode)
        {
            this.unitOfWork         = unitOfWork;
            this.resourceHandler    = resourceHandler;
            this.messageBoxProvider = messageBoxProvider;
            this.roleCache          = roleCache;

            Task.Factory.StartNewWithDefaultCulture(() => this.Load(model));
        }
Esempio n. 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationGroupViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="eventAggregator">Event aggregator.</param>
        /// <param name="viewModelBuilder">View model builder.</param>
        /// <param name="viewBuilder">View builder.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        /// <param name="applicationSettings">Application settings.</param>
        public NotificationGroupViewModel(
            IUnitOfWork unitOfWork,
            IEventAggregator eventAggregator,
            IViewModelBuilder viewModelBuilder,
            IViewBuilder viewBuilder,
            IMessageBoxProvider messageBoxProvider,
            IApplicationSettings applicationSettings)
        {
            this.unitOfWork          = unitOfWork;
            this.eventAggregator     = eventAggregator;
            this.viewModelBuilder    = viewModelBuilder;
            this.viewBuilder         = viewBuilder;
            this.messageBoxProvider  = messageBoxProvider;
            this.applicationSettings = applicationSettings;

            Task.Factory.StartNewWithDefaultCulture(this.UpdateData);
        }
Esempio n. 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AppointmentViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="eventAggregator">Event aggregator.</param>
        /// <param name="viewModelBuilder">Appointment dialog view model.</param>
        /// <param name="viewBuilder">View builder.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        public AppointmentViewModel(
            IUnitOfWork unitOfWork,
            IEventAggregator eventAggregator,
            IViewModelBuilder viewModelBuilder,
            IViewBuilder viewBuilder,
            IMessageBoxProvider messageBoxProvider)
        {
            this.unitOfWork         = unitOfWork;
            this.eventAggregator    = eventAggregator;
            this.viewModelBuilder   = viewModelBuilder;
            this.viewBuilder        = viewBuilder;
            this.messageBoxProvider = messageBoxProvider;

            this.Culture = Thread.CurrentThread.CurrentCulture.Name;

            Task.Factory.StartNewWithDefaultCulture(this.PopulateModelAndStaff);
        }
Esempio n. 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StaffDialogViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        /// <param name="genderCache">Gender cache.</param>
        /// <param name="positionCache">Position cache.</param>
        /// <param name="educationCache">Education cache.</param>
        /// <param name="mode">Mode (Add/Edit).</param>
        /// <param name="model">Staff model.</param>
        public StaffDialogViewModel(
            IUnitOfWork unitOfWork,
            IMessageBoxProvider messageBoxProvider,
            IGenderCache genderCache,
            IPositionCache positionCache,
            IEducationCache educationCache,
            WorkModeType mode,
            StaffModel model = null)
            : base(mode)
        {
            this.unitOfWork         = unitOfWork;
            this.messageBoxProvider = messageBoxProvider;
            this.genderCache        = genderCache;
            this.positionCache      = positionCache;
            this.educationCache     = educationCache;

            Task.Factory.StartNewWithDefaultCulture(() => this.Load(model));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationGroupDialogViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="viewModelBuilder">View model builder.</param>
        /// <param name="viewBuilder">View builder.</param>
        /// <param name="resourceHandler">Resource handler.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        /// <param name="emailDeliveryService">Email delivery service.</param>
        /// <param name="mode">Mode (Add/Edit).</param>
        /// <param name="model">Notification group model.</param>
        public NotificationGroupDialogViewModel(
            IUnitOfWork unitOfWork,
            IViewModelBuilder viewModelBuilder,
            IViewBuilder viewBuilder,
            IResourceHandler resourceHandler,
            IMessageBoxProvider messageBoxProvider,
            IEmailDeliveryService emailDeliveryService,
            WorkModeType mode,
            NotificationGroupModel model)
            : base(mode)
        {
            this.unitOfWork           = unitOfWork;
            this.viewModelBuilder     = viewModelBuilder;
            this.viewBuilder          = viewBuilder;
            this.resourceHandler      = resourceHandler;
            this.messageBoxProvider   = messageBoxProvider;
            this.emailDeliveryService = emailDeliveryService;

            Task.Factory.StartNewWithDefaultCulture(() => this.Load(model));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientDialogViewModel"/> class.
        /// </summary>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <param name="viewModelBuilder">View model builder.</param>
        /// <param name="viewBuilder">View builder.</param>
        /// <param name="messageBoxProvider">Message box provider.</param>
        /// <param name="applicationSettings">Application settings.</param>
        /// <param name="genderCache">Gender cache.</param>
        /// <param name="mode">Mode (Add/Edit).</param>
        /// <param name="model">Patient model.</param>
        public PatientDialogViewModel(
            IUnitOfWork unitOfWork,
            IViewModelBuilder viewModelBuilder,
            IViewBuilder viewBuilder,
            IMessageBoxProvider messageBoxProvider,
            IApplicationSettings applicationSettings,
            IGenderCache genderCache,
            WorkModeType mode,
            PatientModel model = null)
            : base(mode)
        {
            this.unitOfWork          = unitOfWork;
            this.viewModelBuilder    = viewModelBuilder;
            this.viewBuilder         = viewBuilder;
            this.messageBoxProvider  = messageBoxProvider;
            this.applicationSettings = applicationSettings;
            this.genderCache         = genderCache;

            Task.Factory.StartNewWithDefaultCulture(() => this.Load(model));
        }
Esempio n. 22
0
 public static void SetMessageBoxProvider(IMessageBoxProvider provider)
 {
     _provider = provider;
 }
Esempio n. 23
0
        private void DoImport(IProgressMonitor monitor,
                              String importFileName, String targetFileName,
                              bool silent, IMessageBoxProvider messageBoxProvider,
                              System.Action <Exception, bool> dataLoaded)
        {
            m_Monitor        = monitor;
            m_DataLoadedFunc = dataLoaded;
            try
            {
                long overallSize          = 0;
                bool overWrite            = true;
                bool hasAskedForOverwrite = silent;
                bool hasInnerFile         = false;
                using (ZipFile file = CreateZipFile(importFileName))
                {
                    for (int i = 0; i < file.Count; ++i)
                    {
                        ZipEntry entry = file[i];
                        if (entry.IsDirectory)
                        {
                            continue;
                        }
                        bool   isTagsDbFile;
                        String fileName = GetFileName(entry, out isTagsDbFile);
                        if (fileName == String.Empty)
                        {
                            if (hasInnerFile)
                            {
                                throw new ArgumentException(StringResources.InvalidImportFile);
                            }
                            else
                            {
                                hasInnerFile = true;
                                overallSize += entry.Size;
                            }
                        }
                        else if (isTagsDbFile)
                        {
                            overallSize += entry.Size;
                        }
                        else if (FileHelpers.FileExists(fileName))
                        {
                            if (!hasAskedForOverwrite)
                            {
                                switch (messageBoxProvider.ShowYesNoCancelBox(StringResources.ImportOverwrite))
                                {
                                case MessageBoxResult.Yes:
                                    overWrite            = true;
                                    hasAskedForOverwrite = true;
                                    break;

                                case MessageBoxResult.No:
                                    overWrite            = false;
                                    hasAskedForOverwrite = true;
                                    break;

                                default:
                                    return;
                                }
                            }
                            if (overWrite)
                            {
                                overallSize += entry.Size;
                            }
                        }
                        else
                        {
                            overallSize += entry.Size;
                        }
                    }
                    if (!hasInnerFile)
                    {
                        throw new ArgumentException(StringResources.InvalidImportFile);
                    }
                }
                ImportData data = new ImportData();
                data.Overwrite   = overWrite;
                data.ImportFile  = importFileName;
                data.TargetFile  = targetFileName;
                data.OverallSize = overallSize;
                m_Worker         = new System.ComponentModel.BackgroundWorker();
                m_Worker.WorkerReportsProgress      = true;
                m_Worker.WorkerSupportsCancellation = true;
                m_Worker.DoWork             += new System.ComponentModel.DoWorkEventHandler(m_Worker_DoWork);
                m_Worker.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(m_Worker_ProgressChanged);
                m_Worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(m_Worker_RunWorkerCompleted);
                m_Monitor.SetProgress(0, String.Empty);
                m_Worker.RunWorkerAsync(data);
            }
            catch (Exception ex)
            {
                if (dataLoaded != null)
                {
                    dataLoaded(ex, false);
                }
            }
        }
Esempio n. 24
0
 public static void SetMessageBoxProvider(IMessageBoxProvider provider) { _provider = provider; }