예제 #1
0
 public DialogsViewModel()
 {
     //Sample 4
     OpenSample4DialogCommand   = new AnotherCommandImplementation(OpenSample4Dialog);
     AcceptSample4DialogCommand = new AnotherCommandImplementation(AcceptSample4Dialog);
     CancelSample4DialogCommand = new AnotherCommandImplementation(CancelSample4Dialog);
 }
예제 #2
0
        public ProjectViewModel(IStatusNotificationService statusNotificationServiceParam, IProjectDataService projectDataServiceParam, ITabNavigationService tabNavigationServiceParam)
        {
            ProjectFiles = new ObservableCollection <BaseMd>();

            tabNavigationService              = tabNavigationServiceParam;
            statusNotificationService         = statusNotificationServiceParam;
            projectDataService                = projectDataServiceParam;
            projectDataService.ProjectLoaded += ProjectDataService_ProjectLoaded;

            ViewTeamCommand = new AnotherCommandImplementation(t =>
            {
                statusNotificationServiceParam.SendMessage(new Notification()
                {
                    Kind = NotificationKind.Other, Message = t.ToString(), Title = "DEBUG Team", Time = DateTime.Now
                });
            });

            ViewReadmeCommand = new AnotherCommandImplementation(r =>
            {
                if (r is ReadMe readMe)
                {
                    tabNavigationService.CreateTab("ReadMeTab", r);
                }
            });
        }
예제 #3
0
        public MainWindowViewModel(IUsersService usersService,
                                   ITableInfoService tableInfoService,
                                   IColumnInfoService columnInfoService)
        {
            _usersService      = usersService;
            _tableInfoService  = tableInfoService;
            _columnInfoService = columnInfoService;

            _isLoggedIn          = false;
            _accountPopupBoxIcon = new PackIcon
            {
                Kind       = PackIconKind.AccountRemove,
                Width      = 24,
                Height     = 24,
                Margin     = new Thickness(4, 0, 4, 0),
                Foreground = new SolidColorBrush(Color.FromRgb(244, 67, 54))
            };

            _allItems = GenerateNavItems();
            FilterItems(null);

            _selectedItem = _navItems[0];

            MovePrevCommand = new AnotherCommandImplementation(
                _ => SelectedIndex--,
                _ => SelectedIndex > 0);

            MoveNextCommand = new AnotherCommandImplementation(
                _ => SelectedIndex++,
                _ => SelectedIndex < _allItems.Count - 1);
        }
예제 #4
0
 public IconPackViewModel()
 {
     OpenDotComCommand = new AnotherCommandImplementation(OpenDotCom);
     _packIconKinds    = new Lazy <IEnumerable <PackIconKind> >(() =>
                                                                Enum.GetValues(typeof(PackIconKind)).OfType <PackIconKind>()
                                                                .OrderBy(k => k.ToString(), StringComparer.InvariantCultureIgnoreCase).ToList()
                                                                );
 }
예제 #5
0
        public PickPTabViewModel(IStatusNotificationService statusNotificationServiceParam,
                                 ITabNavigationService tabNavigationServiceParam,
                                 IDatabaseService databaseServiceParam,
                                 IProjectDataService projectDataServiceParam)
        {
            statusNotificationService       = statusNotificationServiceParam;
            tabNavigationService            = tabNavigationServiceParam;
            databaseService                 = databaseServiceParam;
            projectDataService              = projectDataServiceParam;
            databaseService.DatabaseChange += DatabaseService_DatabaseChange;

            //Initialize commands.
            ProjectCreateCommand = new AnotherCommandImplementation(t =>
            {
            });

            ProjectOpenCommand = new AnotherCommandImplementation(t =>
            {
                if (CommonFileDialog.IsPlatformSupported)
                {
                    CommonOpenFileDialog folderDialog = new CommonOpenFileDialog("Project Picker")
                    {
                        IsFolderPicker = true,
                    };

                    var diagRes = folderDialog.ShowDialog();
                    if (diagRes == CommonFileDialogResult.Ok)
                    {
                        ProjectLoading(folderDialog.FileName);
                    }
                }
                else
                {
                    statusNotificationService.SendMessage(new Notification()
                    {
                        Kind = NotificationKind.Error, Message = "This Application requires Windows Vista(I think) or up, because I simply refuse to also spawn the classic folder picker. Sorry.", Title = "For the love of everything holy: UPDATE!", Time = DateTime.Now
                    });
                }
            });

            ProjectSelectCommand = new AnotherCommandImplementation(o =>
            {
                if (o is RecentProject project)
                {
                    ProjectLoading(project.Location);
                }
                else
                {
                    statusNotificationService.SendMessage(new Notification()
                    {
                        Kind = NotificationKind.Error, Message = "The picker failed to load the selected project. There might be an issue with the database.", Title = "Loading Failure", Time = DateTime.Now
                    });
                    // TODO: add interaction to remove reference from picker.
                }
            }
                                                                    );
        }
예제 #6
0
        public HomeViewModel(ListBox MenuBox)
        {
            this.MainMenuBox = MenuBox;

            ShowAnalyzerCommand   = new AnotherCommandImplementation(ShowView);
            ShowRecordsCommand    = new AnotherCommandImplementation(ShowView);
            ShowReservoirsCommand = new AnotherCommandImplementation(ShowView);
            ShowHelpCommand       = new AnotherCommandImplementation(ShowView);
        }
예제 #7
0
        public ColorTool()
        {
            ChangeHueCommand = new AnotherCommandImplementation(ChangeHue);

            DataContext = this;
            InitializeComponent();

            MdPaletteButton.IsChecked     = !App.Configuration.StartInCustomPaletteMode;
            CustomPaletteButton.IsChecked = App.Configuration.StartInCustomPaletteMode;
        }
예제 #8
0
        public MainViewModel()
        {
            _mailController             = DummyTrivialSingleton.GetMailControllerService();
            ThemeColorToggleBaseCommand = new AnotherCommandImplementation(o => SetAppColor((bool)o));

            SetAppColor(true);

            // ToDo: Move menu creation to better place or add it in xaml or generate base on some other data.
            _testBurgerMenuItems.Add(new MailMenuItem()
            {
                Name = "Inbox   ", NumberOfEmails = 3, Content = new MailBoxView("Inbox"), IconContent = new PackIcon {
                    Kind = PackIconKind.Inbox
                }
            });
            _testBurgerMenuItems.Add(new MailMenuItem()
            {
                Name = "Drafts", IconContent = new PackIcon {
                    Kind = PackIconKind.Draft
                }
            });
            _testBurgerMenuItems.Add(new MailMenuItem()
            {
                Name = "Sent", IconContent = new PackIcon {
                    Kind = PackIconKind.Send
                }
            });
            _testBurgerMenuItems.Add(new MailMenuItem()
            {
                Name = "Archived", IconContent = new PackIcon {
                    Kind = PackIconKind.Archive
                }
            });
            _testBurgerMenuItems.Add(new MailMenuItem()
            {
                Name = "Important", IconContent = new PackIcon {
                    Kind = PackIconKind.ImportantDevices
                }
            });
            _testBurgerMenuItems.Add(new MailMenuItem()
            {
                Name = "Spam   ", NumberOfEmails = 99, IconContent = new PackIcon {
                    Kind = PackIconKind.Adb
                }
            });
            _testBurgerMenuItems.Add(new MailMenuItem()
            {
                Name = "Trash", IconContent = new PackIcon {
                    Kind = PackIconKind.Trash
                }
            });

            // Subscribe for controller state updates.
            _mailController.ControllerStateStream.ObserveOnDispatcher().Subscribe(state => ConnectionState = state);
        }
예제 #9
0
        public IconPackViewModel(ISnackbarMessageQueue snackbarMessageQueue)
        {
            _snackbarMessageQueue = snackbarMessageQueue ?? throw new ArgumentNullException(nameof(snackbarMessageQueue));

            OpenDotComCommand      = new AnotherCommandImplementation(OpenDotCom);
            SearchCommand          = new AnotherCommandImplementation(Search);
            CopyToClipboardCommand = new AnotherCommandImplementation(CopyToClipboard);
            _packIconKinds         = new Lazy <IEnumerable <PackIconKind> >(() =>
                                                                            Enum.GetValues(typeof(PackIconKind)).OfType <PackIconKind>()
                                                                            .OrderBy(k => k.ToString(), StringComparer.InvariantCultureIgnoreCase).ToList()
                                                                            );
        }
예제 #10
0
        public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue)
        {
            _allItems = GenerateDemoItems(snackbarMessageQueue);
            FilterItems(null);

            MovePrevCommand = new AnotherCommandImplementation(
                _ => SelectedIndex--,
                _ => SelectedIndex > 0);

            MoveNextCommand = new AnotherCommandImplementation(
                _ => SelectedIndex++,
                _ => SelectedIndex < _allItems.Count - 1);
        }
        public RecordManagerViewModel(ISnackbarMessageQueue snackbarMessageQueue)
        {
            _snackbarMessageQueue = snackbarMessageQueue ?? throw new ArgumentNullException(nameof(snackbarMessageQueue));

            _viewMethods = new ObservableCollection <ViewMethodViewModel>
            {
                new ViewMethodViewModel {
                    Id = 0, Name = "Daily"
                },
                new ViewMethodViewModel {
                    Id = 1, Name = "Monthly"
                }
            };
            _viewMethod = new ViewMethodViewModel {
                Id = 0, Name = "Daily"
            };

            ShowMessageCommand = new AnotherCommandImplementation(ShowMessage);

            Date         = DateTime.Now;
            Time         = DateTime.Now;
            OverallIndex = "0";
            Level        = "0";
            Explanation  = " ";

            TemperatureRange = new ObservableCollection <OxygenDOViewModel>
            {
                new OxygenDOViewModel {
                    Id = 0, TemperatureRange = "0~10°C", Temperature = 10
                },
                new OxygenDOViewModel {
                    Id = 1, TemperatureRange = "11~20°C", Temperature = 20
                },
                new OxygenDOViewModel {
                    Id = 2, TemperatureRange = "21~30°C", Temperature = 30
                }
            };

            PH   = "";
            DO   = "";
            BOD5 = "";
            COD  = "";
            NH4N = "";
            NO2N = "";
            NO3N = "";
            SS   = "";
            CL   = "";
            CB   = "";
        }
예제 #12
0
        public IconPackViewModel(ISnackbarMessageQueue snackbarMessageQueue)
        {
            _snackbarMessageQueue = snackbarMessageQueue ?? throw new ArgumentNullException(nameof(snackbarMessageQueue));

            OpenDotComCommand      = new AnotherCommandImplementation(OpenDotCom);
            SearchCommand          = new AnotherCommandImplementation(Search);
            CopyToClipboardCommand = new AnotherCommandImplementation(CopyToClipboard);

            _packIconKinds = new Lazy <IEnumerable <PackIconKindGroup> >(() =>
                                                                         Enum.GetNames(typeof(PackIconKind))
                                                                         .GroupBy(k => (PackIconKind)Enum.Parse(typeof(PackIconKind), k))
                                                                         .Select(g => new PackIconKindGroup(g))
                                                                         .OrderBy(x => x.Kind)
                                                                         .ToList());
        }
예제 #13
0
        public DialogsViewModel()
        {
            //Sample 4
            OpenSample4DialogCommand = new AnotherCommandImplementation(OpenSample4Dialog);
            //        AcceptSample4DialogCommand = new AnotherCommandImplementation(AcceptSample4Dialog);
            CancelSample4DialogCommand = new AnotherCommandImplementation(CancelSample4Dialog);
            //   AddPatCommand = new AnotherCommandImplementation(AddComm);
            ChangePageCommand = new AnotherCommandImplementation(nextPage);
            delPatient        = new AnotherCommandImplementation(deletePatient);
            changinfo         = new AnotherCommandImplementation(change);
            logoutCommand     = new AnotherCommandImplementation(logout);
            exitCommand       = new AnotherCommandImplementation(exit);

            FillObservableCollection();
        }
        public AnalyzerViewModel(ISnackbarMessageQueue snackbarMessageQueue)
        {
            _snackbarMessageQueue = snackbarMessageQueue ?? throw new ArgumentNullException(nameof(snackbarMessageQueue));

            Date         = DateTime.Now;
            Time         = DateTime.Now;
            OverallIndex = "0";
            Level        = "0";
            Explanation  = " ";

            TemperatureRange = new ObservableCollection <OxygenDOViewModel>
            {
                new OxygenDOViewModel {
                    Id = 0, TemperatureRange = "0~10°C", Temperature = 10
                },
                new OxygenDOViewModel {
                    Id = 1, TemperatureRange = "11~20°C", Temperature = 20
                },
                new OxygenDOViewModel {
                    Id = 2, TemperatureRange = "21~30°C", Temperature = 30
                }
            };

            /*
             * Reservoirs = new ObservableCollection<Reservoir>
             * {
             *  new Reservoir { Id = 0, Name = "Lake Kariba" },
             *  new Reservoir { Id = 1, Name = "Bratsk Reservoir" },
             *  new Reservoir { Id = 2, Name = "Lake Volta" },
             *  new Reservoir { Id = 3, Name = "Manicouagan Reservoir" },
             *  new Reservoir { Id = 4, Name = "Lake Guri" }
             * };
             */

            PH   = "";
            DO   = "";
            BOD5 = "";
            COD  = "";
            NH4N = "";
            NO2N = "";
            NO3N = "";
            SS   = "";
            CL   = "";
            CB   = "";

            ShowMessageCommand = new AnotherCommandImplementation(ShowMessage);
        }
 public Buttons()
 {
     InitializeComponent();
     FloatingActionDemoCommand = new AnotherCommandImplementation(Execute);
 }
예제 #16
0
 private void InitializeCommands()
 {
     ResetComand = new AnotherCommandImplementation(ExecuteResetCommand, CanExecuteResetCommand);
 }
        public ButtonsViewModel()
        {
            var autoStartingActionCountdownStart = DateTime.Now;
            var demoRestartCountdownComplete     = DateTime.Now;
            var dismissRequested = false;

            DismissComand     = new AnotherCommandImplementation(_ => dismissRequested = true);
            ShowDismissButton = true;

            #region DISMISS button demo control
            //just some demo code for the DISMISS button...it's up to you to set
            //up the progress on the button as it would be with a progress bar.
            //and then hide the button, do whatever action you want to do
            new DispatcherTimer(
                TimeSpan.FromMilliseconds(100),
                DispatcherPriority.Normal,
                new EventHandler((o, e) =>
            {
                if (dismissRequested)
                {
                    ShowDismissButton            = false;
                    dismissRequested             = false;
                    demoRestartCountdownComplete = DateTime.Now.AddSeconds(3);
                    DismissButtonProgress        = 0;
                }

                if (ShowDismissButton)
                {
                    var totalDuration   = autoStartingActionCountdownStart.AddSeconds(5).Ticks - autoStartingActionCountdownStart.Ticks;
                    var currentDuration = DateTime.Now.Ticks - autoStartingActionCountdownStart.Ticks;
                    var autoCountdownPercentComplete = 100.0 / totalDuration * currentDuration;
                    DismissButtonProgress            = autoCountdownPercentComplete;

                    if (DismissButtonProgress >= 100)
                    {
                        demoRestartCountdownComplete = DateTime.Now.AddSeconds(3);
                        ShowDismissButton            = false;
                        UpdateDemoRestartCountdownText(demoRestartCountdownComplete, out _);
                    }
                }
                else
                {
                    UpdateDemoRestartCountdownText(demoRestartCountdownComplete, out bool isComplete);
                    if (isComplete)
                    {
                        autoStartingActionCountdownStart = DateTime.Now;
                        ShowDismissButton = true;
                    }
                }
            }), Dispatcher.CurrentDispatcher);
            #endregion

            //just some demo code for the SAVE button
            SaveComand = new AnotherCommandImplementation(_ =>
            {
                if (IsSaveComplete == true)
                {
                    IsSaveComplete = false;
                    return;
                }

                if (SaveProgress != 0)
                {
                    return;
                }

                var started = DateTime.Now;
                IsSaving    = true;

                new DispatcherTimer(
                    TimeSpan.FromMilliseconds(50),
                    DispatcherPriority.Normal,
                    new EventHandler((o, e) =>
                {
                    var totalDuration          = started.AddSeconds(3).Ticks - started.Ticks;
                    var currentProgress        = DateTime.Now.Ticks - started.Ticks;
                    var currentProgressPercent = 100.0 / totalDuration * currentProgress;

                    SaveProgress = currentProgressPercent;

                    if (SaveProgress >= 100)
                    {
                        IsSaveComplete = true;
                        IsSaving       = false;
                        SaveProgress   = 0;
                        ((DispatcherTimer)o).Stop();
                    }
                }), Dispatcher.CurrentDispatcher);
            });
        }