public MainWindowViewModel(
            )     //
        {
            var startupWindow = new StartupWindow();

            startupWindow.Show();
            try
            {
                InitializeDatabase();
                LoadFromDB();
                InitializeFolder();
                //InitializeTempFileFolder();
                CreateProcesserForTesters();
                CreateViewModels();
                //以下三个函数只用调用一次即可
                //UpdateStatus();
                //UpdateTime();
                //UpdateEditable();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            finally
            {
                startupWindow.Close();
            }
        }
예제 #2
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            StartupWindow startupWindow = new StartupWindow();

            startupWindow.Show();

            FilesControlObject      = new FilesControl();
            SettingsControlObject   = new SettingsControl();
            PlayerControlObject     = new PlayerControl();
            UserRatingControlObject = new UserRatingControl();

            SV_MainDisplay.Content = FilesControlObject;
            MakeButtonPressedOnLeft(Button_FileControl);
            await WarmupMediaInfoEngine();
            await SearchForVLCDLL();
            await LoadUserSettings();

            startupWindow.Close();

            if (WindowState == WindowState.Minimized)
            {
                WindowState = WindowState.Normal;
            }

            Activate();
        }
예제 #3
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            StaticMessageBoxSpawner.Spawner = new WpfMessageBoxSpawner();
            StaticUiUpdateNotifier.Notifier = new WpfUiUpdateNotifier();
            var clipboard = new WpfClipboard();

            var startWindow = new StartupWindow {
                ApplicationName = "File uploader"
            };

            startWindow.Show();
            var apiConfiguration = new ApiConfiguration(
                Settings.Default.ApiServerAddress,
                Settings.Default.ApiServerPort);
            var dataApiClient = new DataApiClient(apiConfiguration);

            if (!dataApiClient.IsAvailable())
            {
                MessageBox.Show($"Cannot contact DataAPI @ '{apiConfiguration.ServerAddress}:{apiConfiguration.ServerPort}'. Shutting down...");
                Current.Shutdown(-1);
                return;
            }
            try
            {
                dataApiClient.Login();
            }
            catch
            {
                // Ignore. If Active Directory is not available, in some other way later.
            }

            var imageDatabase                 = new GenericDatabase <Image>(dataApiClient);
            var shortIdDatabase               = new GenericDatabase <ShortId>(dataApiClient);
            var dataSetDatabase               = new GenericDatabase <DataSet>(dataApiClient);
            var tagDatabase                   = new GenericDatabase <DataTag>(dataApiClient);
            var projectDatabase               = new GenericDatabase <DataProject>(dataApiClient);
            var protocolDatabase              = new GenericDatabase <DataCollectionProtocol>(dataApiClient);
            var protocolParameterDatabase     = new GenericDatabase <DataCollectionProtocolParameter>(dataApiClient);
            var dataBlobDatabase              = new GenericDatabase <DataBlob>(dataApiClient);
            var dataProjectUploadInfoDatabase = new GenericDatabase <DataProjectUploadInfo>(dataApiClient);

            var fileHandlers = new IFileHandler[]
            {
                new ImageFileHandler(imageDatabase)
            };
            var additionalInformationViewSpawner = new WpfAdditionalInformationViewSpawner();
            var fileManager = new UploadedFileProcessor(
                fileHandlers,
                dataApiClient,
                dataBlobDatabase,
                dataProjectUploadInfoDatabase,
                clipboard,
                additionalInformationViewSpawner);

            var mainWindow    = new MainWindow();
            var mainViewModel = new MainViewModel(
                mainWindow,
                dataApiClient,
                fileManager,
                dataSetDatabase,
                tagDatabase,
                projectDatabase,
                protocolDatabase,
                protocolParameterDatabase);

            mainWindow.ViewModel = mainViewModel;
            startWindow.Close();
            mainWindow.ShowDialog();
        }