public InsertDiskViewModel()
        {
            _rootPath = Settings.Default["Path"].ToString();

            if (string.IsNullOrWhiteSpace(_rootPath))
            {
                BreadcrumbHelper.GotoPage(new NoPathPage());
            }

            SelectedPassenger = UserSelection.SelectedPassenger;

            Drives = DriveInfo.GetDrives().Where(d => d.DriveType == DriveType.Removable).ToList();
            ListenDrive();

            PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "SelectedDrive")
                {
                    DriveInfo info = new DriveInfo(SelectedDrive);
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        BreadcrumbHelper.GotoPage(new DrivePage(info));
                    });
                }
            };
        }
        public NoPathPage()
        {
            InitializeComponent();
            var path = Settings.Default["Path"].ToString();

            if (!string.IsNullOrWhiteSpace(path))
            {
                BreadcrumbHelper.GotoPage(new InsertDiskPage());
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            var appTheme    = Settings.Default["AppTheme"].ToString();
            var themeAccent = Settings.Default["ThemeAccent"].ToString();
            var path        = Settings.Default["Path"].ToString();

            ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(themeAccent), ThemeManager.GetAppTheme(appTheme));

            BreadcrumbHelper.MainWindow = this;
            if (!string.IsNullOrWhiteSpace(path))
            {
                BreadcrumbHelper.GotoPage(new PassengersView());
            }
            else
            {
                BreadcrumbHelper.GotoPage(new NoPathPage());
            }
        }
        private void ListenPropertyChanged()
        {
            PropertyChanged += (sender, args) =>
            {
                switch (args.PropertyName)
                {
                case "SelectedPassenger":
                    UserSelection.SelectedPassenger = SelectedPassenger;
                    CheckPassengerFolders(SelectedPassenger);
                    BreadcrumbHelper.GotoPage(new InsertDiskPage());
                    break;

                case "ShowPhoto":
                case "ShowVideo":
                case "SearchTerm":
                    Passengers =
                        _unfilteredPassengers
                        .Where(x => (x.IsPhoto == ShowPhoto && x.IsVideo == ShowVideo) || (ShowPhoto == ShowVideo))
                        .Where(x => string.IsNullOrWhiteSpace(SearchTerm) || x.FullName.ToLower().Contains(SearchTerm.ToLower()))
                        .ToList();
                    break;
                }
            };
        }
 private void SettingsClick(object sender, RoutedEventArgs e)
 {
     BreadcrumbHelper.GotoPage(new SettingsPage());
 }
示例#6
0
 public BaseViewModel()
 {
     GoBackCommand = new MyCommand(null, () => BreadcrumbHelper.GoBack());
     GoToPassengerSelectionCommand = new MyCommand(null, () => BreadcrumbHelper.GotoPage(new PassengersView()));
 }