private async void refreshContext()
        {
            try
            {
                Task refreshContextTask = null;
                refreshContextTask = Task.Run(() =>
                {
                    simulatedDelay();

                    SQLConnection.Close();
                    SQLConnection.Initialize(Statics.DatabaseFile);
                });
                await refreshContextTask;

                if (refreshContextTask != null)
                {
                    refreshContextTask.Dispose();
                }

                querySQL(1);
            }
            catch (Exception Ex)
            {
                LogWriter.Exception("Bummer. That search delay broke somehow.", Ex);
            }
        }
Beispiel #2
0
        private void connectTaskStart(object sender, TaskWorkerEventArgs e)
        {
            ConnectMessage        = "Connecting to local database...";
            ConnectButtonContent  = "Abort Connection";
            ProgressBarIsEnabled  = true;
            ProgressBarVisibility = System.Windows.Visibility.Visible;

            simulatedDelay();

            if (taskWorker.CancellationRequested)
            {
                return;
            }

            // Connects to the Database.
            if (SQLConnection.Initialize(Statics.DatabaseFile))
            {
                e.Results = true;
            }
        }