Пример #1
0
        public TeilnehmerViewModel(IWindowController controller) : base(controller)
        {
            TestResults = new List <TestResult>
            {
                TestResult.Unknown,
                TestResult.Negative,
                TestResult.Positive
            };

            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Environment.CurrentDirectory)
                                .AddJsonFile("appsettings.json")
                                .AddUserSecrets <TwilioSmsService>()
                                .AddEnvironmentVariables()
                                .Build();

            _smsService = new TwilioSmsService(
                configuration["Twilio:AccountSid"], configuration["Twilio:AuthToken"]);

            _stringRandomizer         = new Randomizer();
            Message                   = string.Empty;
            Examination               = null;
            _participantSmsIdentifier = string.Empty;
            ExaminationIdentifier     = null;
            ParticipantIdentifier     = null;
            SelectedTestResult        = TestResult.Unknown;
            LoadCommandsAsync();
        }
 public MembersViewModel(IWindowController windowController, Member member) : base(windowController)
 {
     Member = member;
     LastName = member.LastName;
     FirstName = member.FirstName;
     LoadCommands();
 }
        /// <summary>
        /// Registers a screen. If transform is passed, the layer will
        /// reparent it to itself. Screens can only be shown after they're registered.
        /// </summary>
        /// <param name="screenId">Screen identifier.</param>
        /// <param name="controller">Controller.</param>
        /// <param name="screenTransform">Screen transform. If not null, will be reparented to proper layer</param>
        public void RegisterScreen(string screenId, IUIScreenController controller, Transform screenTransform)
        {
            IWindowController window = controller as IWindowController;

            if (window != null)
            {
                windowLayer.RegisterScreen(screenId, window);
                if (screenTransform != null)
                {
                    windowLayer.ReparentScreen(controller, screenTransform);
                }

                return;
            }

            IPanelController panel = controller as IPanelController;

            if (panel != null)
            {
                panelLayer.RegisterScreen(screenId, panel);
                if (screenTransform != null)
                {
                    panelLayer.ReparentScreen(controller, screenTransform);
                }
            }
        }
Пример #4
0
        public T Open <T>() where T : class, IWindowController
        {
            var window = _factory.Create <T>();

            if (window == null)
            {
                return(null);
            }

            window.Owner.SetParent(_root.Root, false);

            //TODO: add modal, single types
            if (window.Mode == WindowMode.Single)
            {
                _windows.Add(window);
                window.Open();
            }
            else if (window.Mode == WindowMode.Modal)
            {
                _modalWindow?.Close();
                _modalWindow = window;
                window.Open();
            }

            WindowOpen?.Invoke(window);

            return(window);
        }
Пример #5
0
 public void RemoveWindow(IWindowController window)
 {
     if (_current == window)
     {
         _current.Hide();
     }
 }
Пример #6
0
 public ScheduleManagerViewModel(IWindowFactory windowFactory, IWindowController windowController, IDataManager dataManager, int userId)
     : base(windowFactory, windowController)
 {
     this.userId      = userId;
     this.dataManager = dataManager;
     schedules        = new ObservableCollection <ScheduleViewModel>();
     LoadSchedulesList();
     add = new RelayCommand(_ =>
     {
         Schedule model = new Schedule();
         model.UserId   = userId;
         windowFactory.CreateScheduleInfoEditorWindow(model, false);
         LoadSchedulesList();
     });
     edit = new RelayCommand(_ =>
     {
         windowFactory.CreateScheduleInfoEditorWindow(dataManager.GetScheduleById(userId, selectedSchedule.Id), true);
         LoadSchedulesList();
     }, _ => CanEditOrDelete);
     delete = new RelayCommand(_ =>
     {
         dataManager.RemoveSchedule(selectedSchedule.UserId, selectedSchedule.Id);
         LoadSchedulesList();
     }, _ => CanEditOrDelete);
 }
Пример #7
0
        public static async Task <MainViewModel> CreateAsync(IWindowController windowController)
        {
            var viewModel = new MainViewModel(windowController);
            await viewModel.LoadDataAsync();

            return(viewModel);
        }
Пример #8
0
        public MainWindowViewModel()
        {
            DARPResults       = null;
            ILSEvolution      = null;
            AlgorithmSummary  = null;
            ChartsViewModel   = null;
            VNSOperators      = null;
            ProblemsInput     = null;
            SolutionsData     = null;
            DARPProblems      = new List <string>();
            DARPSelected      = null;
            HeuristicExecuted = false;
            TabSelected       = 0;

            //Inicializate Commands
            LoadInput       = commands.AddAsyncCommand(ExecuteLoadProblems, CanExecuteLoadProblems);
            SettingsCommand = commands.AddCommand(ExecuteOpenSettings, CanExecuteOpenSettings);
            RunHeuristic    = commands.AddAsyncCommand(ExecuteRunHeuristic, CanExecuteRunHeuristic);
            ExportCSV       = commands.AddAsyncCommand(ExecuteExportCSV, CanExecuteExportCSV);

            //Load Settings
            Context.Instance.Settings = DARP.Settings.CheckDeserializeSettings(LoadLasSettings());

            //Inicializate controllers.
            var controllers = ViewModelControllers.Instance;

            windowController  = controllers.WindowController;
            processController = ProcessController.Instance;
            splashController  = controllers.SplashController;
        }
Пример #9
0
        public static async Task <TeilnehmerViewModel> Create(IWindowController controller, Participant participant)
        {
            var model = new TeilnehmerViewModel(controller);
            await model.LoadParticipantAsync(participant);

            return(model);
        }
Пример #10
0
        public virtual bool SetWindowController(IWindowController windowController, bool throwException = true)
        {
            if (windowController is TController controller)
            {
                try {
                    this.WindowController = controller;
                    return(true);
                } catch (InvalidOperationException) {
                    if (throwException)
                    {
                        throw;
                    }
                }
            }
            else if (windowController == null)
            {
                this.WindowController = default(TController);
                return(true);
            }
            else
            {
                if (throwException)
                {
                    throw new InvalidCastException(nameof(TController));
                }
            }

            return(false);
        }
Пример #11
0
 public AccessViewModel(IWindowController windowFactory, string Path)
 {
     this.windowFactory = windowFactory;
     RegistrationMode = false;
     dialogService = new DefaultDialogService();
     this.DBPath = Path;
 }
Пример #12
0
            public void OnWindowAction(WindowActionType actionType, IWindowController controller)
            {
                switch (actionType)
                {
                case WindowActionType.Undefined:
                    break;

                case WindowActionType.Open:
                    UpdateState(WindowState.InProgress);
                    break;

                case WindowActionType.Blocked:
                    UpdateState(WindowState.Paused);
                    break;

                case WindowActionType.Unblocked:
                    UpdateState(WindowState.InProgress);
                    break;

                case WindowActionType.Closed:
                    UpdateState(WindowState.Completed);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(actionType), actionType, null);
                }
            }
Пример #13
0
 public LoginViewModel(IWindowController contr, Party selectedParty) : base(contr)
 {
     _windowController = contr;
     SelectedParty     = selectedParty;
     Errors            = new Dictionary <string, List <string> >();
     LoadCommands();
 }
Пример #14
0
 public ScheduleInfoEditorViewModel(IWindowFactory windowFactory, IWindowController windowController, IDataManager dataManager, Schedule schedule, bool edit)
     : base(windowFactory, windowController)
 {
     selectedDayOfWeek = DateCharacteristic.GetDayOfWeek(schedule.DayOfWeek);
     selectedHour      = schedule.Hour.ToString();
     selectedMinute    = schedule.Minute.ToString();
     this.dataManager  = dataManager;
     this.edit         = edit;
     this.schedule     = new ScheduleViewModel(schedule);
     scheduleModel     = schedule;
     ready             = new RelayCommand(ReadyExecute, _ => CanReadyExecute);
     cancel            = new RelayCommand(CancelExecute);
     addProduct        = new RelayCommand(AddProductExecute, _ => CanAddProduct);
     addDish           = new RelayCommand(AddDishExecute, _ => CanAddDish);
     delete            = new RelayCommand(DeleteExecute, _ => CanDeleteFood);
     dishes            = new ObservableCollection <DishViewModel>();
     products          = new ObservableCollection <FoodViewModel>();
     food = new ObservableCollection <FoodViewModel>();
     foreach (Dish d in dataManager.GetDishList())
     {
         dishes.Add(new DishViewModel(d));
     }
     foreach (Product p in dataManager.GetProductList())
     {
         products.Add(new FoodViewModel(p));
     }
     foreach (Food f in scheduleModel.Food)
     {
         food.Add(new FoodViewModel(f));
     }
 }
Пример #15
0
        public static async Task <BaseViewModel> Create(IWindowController controller)
        {
            var model = new MainWindowViewModel(controller);
            await model.LoadBooks();

            return(model);
        }
Пример #16
0
 public LoginViewModel(IWindowFactory windowFactory, IWindowController windowController, IAuthorization authorization)
     : base(windowFactory, windowController)
 {
     this.authorization = authorization;
     enter           = new RelayCommand(EnterExecute);
     registration    = new RelayCommand((obj) => WindowFactory.CreateRegisterWindow());
     passwordChanged = new RelayCommand((obj) => Password = (obj as PasswordBox).Password);
 }
 public MainWindowViewModel(IWindowController windowController, PartyGuest guest) : base(windowController)
 {
     if (guest != null)
     {
         GuestController guestController = new GuestController();
         GuestViewModel  viewModel       = new GuestViewModel(guestController, partyGuest: guest);
         guestController.ShowWindow(viewModel);
     }
 }
Пример #18
0
 public ApplicationController(IEventAggregator eventAggregator,
                              IConvenientWindowManager windowManager,
                              IWindowController windowController,
                              IGameMonitor gameMonitor,
                              IPlayerNotifier playerNotifier,
                              ISplunkLogger splunkLogger,
                              IKataFilesMonitor kataFilesMonitor,
                              IReminderTimer reminderTimer,
                              IMonitorTimer monitorTimer)
 {
     if (eventAggregator == null)
     {
         throw new ArgumentNullException(nameof(eventAggregator));
     }
     if (windowManager == null)
     {
         throw new ArgumentNullException(nameof(windowManager));
     }
     if (windowController == null)
     {
         throw new ArgumentNullException(nameof(windowController));
     }
     if (gameMonitor == null)
     {
         throw new ArgumentNullException(nameof(gameMonitor));
     }
     if (playerNotifier == null)
     {
         throw new ArgumentNullException(nameof(playerNotifier));
     }
     if (splunkLogger == null)
     {
         throw new ArgumentNullException(nameof(splunkLogger));
     }
     if (kataFilesMonitor == null)
     {
         throw new ArgumentNullException(nameof(kataFilesMonitor));
     }
     if (reminderTimer == null)
     {
         throw new ArgumentNullException(nameof(reminderTimer));
     }
     if (monitorTimer == null)
     {
         throw new ArgumentNullException(nameof(monitorTimer));
     }
     _eventAggregator  = eventAggregator;
     _windowManager    = windowManager;
     _windowController = windowController;
     _gameMonitor      = gameMonitor;
     _playerNotifier   = playerNotifier;
     _splunkLogger     = splunkLogger;
     _kataFilesMonitor = kataFilesMonitor;
     _reminderTimer    = reminderTimer;
     _monitorTimer     = monitorTimer;
     eventAggregator.Subscribe(this);
 }
Пример #19
0
 public RegistrationViewModel(IWindowFactory windowFactory, IWindowController windowController, IRegistration registration)
     : base(windowFactory, windowController)
 {
     this.registration    = registration;
     register             = new RelayCommand(RegisterExecute, _ => CanExecuteRegister);
     cancel               = new RelayCommand((obj) => WindowController.CloseWindow());
     passwordChanged      = new RelayCommand((obj) => Password = (obj as PasswordBox).Password);
     passwordAgainChanged = new RelayCommand((obj) => PasswordAgain = (obj as PasswordBox).Password);
 }
Пример #20
0
 public SupplyViewModel(IWindowController controller, AgencySQLDb sql, User user, string UserName)
 {
     CurrentUser      = user;
     this.UserName    = UserName;
     windowController = controller;
     db        = sql;
     searchSet = new SearchSet();
     UpdateTransactionTable();
     searchSet.SearchSetChanged += SearchSet_SearchSetChanged;
 }
Пример #21
0
 public UserEditViewModel(IWindowController windowController, IDataManager dataManager, int id)
     : base(windowController)
 {
     this.dataManager = dataManager;
     this.id          = id;
     age        = dataManager.GetUserAge(id);
     ready      = new RelayCommand(ReadyExecute, _ => CanReadyExecute);
     cancel     = new RelayCommand(_ => windowController.CloseWindow());
     customData = new HumanCharacteristicViewModel(dataManager.GetUser(id));
 }
 public ProductInfoEditorViewModel(IWindowController windowController, IDataManager dataManager, Product product, bool edit)
     : base(windowController)
 {
     this.dataManager = dataManager;
     this.edit        = edit;
     this.product     = new FoodViewModel(product);
     productModel     = product;
     this.name        = product.Name;
     ready            = new RelayCommand(ReadyExecute, _ => CanReadyExecute);
     cancel           = new RelayCommand(CancelExecute);
 }
Пример #23
0
        public ParticipantViewModel(IWindowController controller) : base(controller)
        {
            TestResults = new List <TestResult>
            {
                TestResult.Unknown,
                TestResult.Negative,
                TestResult.Positive
            };

            LoadCommands();
        }
Пример #24
0
 public EditViewModel(IWindowController controller, AgencySQLDb DataBase)
 {
     dialog             = new DefaultDialogService();
     windowController   = controller;
     SqlDataBase        = DataBase;
     TransactionsEdit   = new List <DataRow>();
     OfficeEmployeeEdit = new List <DataRow>();
     OfficeEdit         = new List <DataRow>();
     SeekerEdit         = new List <DataRow>();
     SaleEdit           = new List <DataRow>();
     EmployeeEdit       = new List <DataRow>();
     RefreshData();
 }
Пример #25
0
        public GuestViewModel(IWindowController windowController, PartyGuest partyGuest) : base(windowController)
        {
            PartyPlayList             = new PlayList();
            SelectedVoteTrack         = new ListTrack();
            TracksOfPartyPlayList     = new List <ListTrack>();
            PartyTweets               = new List <PartyTweet>();
            _selectedRecommendedTrack = new Track();

            TextPartyTweet = "";

            LoadCommands();
            LoadData(partyGuest);
        }
Пример #26
0
 private void MoveBottomModal(IWindowController controller)
 {
     if (_windowCtrls.Count > 0 && _windowCtrls[_windowCtrls.Count - 1].View.Attributes.Contains(WindowAttribute.Modal))
     {
         var modalCtrl = _windowCtrls[_windowCtrls.Count - 1];
         _windowCtrls.RemoveAt(_windowCtrls.Count - 1);
         MoveBottomModal(controller);
         _windowCtrls.Add(modalCtrl);
     }
     else
     {
         _windowCtrls.Add(controller);
     }
 }
Пример #27
0
        public void AddWindow(IWindowController window)
        {
            CloseWindow();
            if (_current == window)
            {
                return;
            }

            _current = window;
            //_current.Owner.parent = _root.Root;
            //var rectTransform = _current.Owner.GetComponent<RectTransform>();
            //rectTransform.anchoredPosition = Vector2.zero;
            //rectTransform.localScale = Vector3.one;
        }
Пример #28
0
 public RationViewModel(IWindowFactory windowFactory, IWindowController windowController, IDataManager dataManager, int id)
     : base(windowFactory, windowController)
 {
     timeTimer.Elapsed += SecondElapsed;
     timeTimer.Start();
     timeNow            = DateTime.Now;
     schedules          = new ObservableCollection <ScheduleViewModel>();
     authorizationId    = id;
     this.dataManager   = dataManager;
     editProducts       = new RelayCommand(_ => { windowFactory.CreateProductsManagerWindow(); LoadSchedulesList(); });
     editDishes         = new RelayCommand(_ => { windowFactory.CreateDishesManagerWindow(); LoadSchedulesList(); });
     editSchedules      = new RelayCommand(_ => { windowFactory.CreateScheduleManagerWindow(id); LoadSchedulesList(); });
     editUserData       = new RelayCommand(_ => { windowFactory.CreateUserEditWindow(id); RaisePropertyChanged("DailyRequirement"); });
     CanExecuteOnClosed = true;
     LoadSchedulesList();
 }
Пример #29
0
        public void Close(IWindowController window)
        {
            if (window == null)
            {
                return;
            }

            WindowPreClose?.Invoke(window);

            _windows.Remove(window);
            if (_modalWindow == window)
            {
                _modalWindow = null;
            }

            _factory.Remove(window);

            WindowClose?.Invoke(window);
        }
Пример #30
0
 public DishesManagerViewModel(IWindowFactory windowFactory, IWindowController windowController, IDataManager dataManager)
     : base(windowFactory, windowController)
 {
     dishes           = new ObservableCollection <DishViewModel>();
     this.dataManager = dataManager;
     LoadDishesList();
     add = new RelayCommand(_ =>
     {
         windowFactory.CreateDishInfoEditorWindow(new Dish(), false);
         LoadDishesList();
     });
     edit = new RelayCommand(_ =>
     {
         windowFactory.CreateDishInfoEditorWindow(dataManager.GetDishByName(selectedDish.Name), true);
         LoadDishesList();
     }, _ => CanEditOrDelete);
     delete = new RelayCommand(_ =>
     {
         dataManager.RemoveDish(selectedDish.Name);
         LoadDishesList();
     }, _ => CanEditOrDelete);
 }
Пример #31
0
 public override void Draw(IWindowController windowController)
 {
     base.Draw(windowController);
     GUI.Box(Bound, mData.ProjectPath);
 }
Пример #32
0
        private void InitializeDesignTime(IController controller, IIdleTimeProvider idleTimeProvider, ISummaryDataManager summaryDataManager, IWindowController windowController, IVersionService versionService)
        {
            this.ApplicationTitle = Title;
            this.idleTimeProvider = idleTimeProvider;
            this.summaryDataManager = summaryDataManager;
            this.summaryDataManager.Message += (s, e) => { AddMessage(e.Message); };
            this.windowController = windowController;

            this.Messages = new ObservableCollection<string>();
            this.DataPointsHashRate = new ObservableCollection<DataPoint>();
            this.GraphTimeSpans = new ObservableCollection<GraphTimeSpan>(LoadGraphTimeSpans());

            var durations = new List<TimeSpan>();
            foreach (string durationText in Settings.Default.SnoozeDurations)
            {
                TimeSpan duration;
                if (TimeSpan.TryParse(durationText, out duration))
                {
                    durations.Add(duration);
                    if (duration == Settings.Default.DefaultSnoozeDuration)
                    {
                        this.SnoozeDuration = duration;
                    }
                }
            }

            this.SnoozeDurations = durations;

            if (!IsDesignMode)
            {
                this.InitializeRunTime(controller, versionService);
            }

            this.Activity = UserActivity.Active; // initial setting
        }
Пример #33
0
 public MiningViewModel(IController controller, IIdleTimeProvider idleTimeProvider, ISummaryDataManager summaryDataManager, IWindowController windowController, IVersionService versionService)
 {
     this.InitializeDesignTime(controller, idleTimeProvider, summaryDataManager, windowController, versionService);
 }
Пример #34
0
        /// <summary>
        /// 用于具体控件(子类)渲染
        /// </summary>
        /// <param name="windowController"></param>

        public virtual void Draw(IWindowController windowController)
        {   }
Пример #35
0
 public ShellViewModelTests()
 {
     _windowController = MockRepository.GenerateStub<IWindowController>();
     _eventAggregator = MockRepository.GenerateStub<IEventAggregator>();
 }
Пример #36
0
        /// <summary>
        /// 用于
        /// </summary>
        /// <param name="windowController"></param>

        internal void DrawControl(IWindowController windowController)
        {
            Draw(windowController);

            for (int i = 0; i < mChilds.Count; i++)
            {
                mChilds[i].DrawControl(windowController);
            }
        }
Пример #37
0
        /// <summary>
        /// Layout
        /// </summary>
        /// <param name="windowController"></param>

        public virtual void Layout(IWindowController windowController)
        {
            var parent = Parent;
            if (MarginLeftPoint != null)
            {
                X = MarginLeftPoint.Calc(parent.Width);
            }

            if (MarginTopPoint != null)
            {
                Y = MarginTopPoint.Calc(parent.Height);
            }

            if (MarginRightPoint != null)
                Width = Mathf.Abs(parent.Width - MarginRightPoint.Calc(parent.Width) - X);

            if (MarginBottomPoint != null)
                Height = Mathf.Abs(parent.Height - MarginBottomPoint.Calc(parent.Height) - Y);
        }
Пример #38
0
 public override void Draw(IWindowController windowController)
 {
     GUI.Box(Bound, ToString());
 }