Exemple #1
0
        private async void ChooseDriverStoreToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (ChooseDriverStore chooseDriverStore = new ChooseDriverStore())
            {
                chooseDriverStore.StoreType = this.driverStore.Type;
                if (this.driverStore.Type == DriverStoreType.Offline)
                {
                    chooseDriverStore.OfflineStoreLocation = this.driverStore.OfflineStoreLocation;
                }

                chooseDriverStore.RightToLeft       = this.RightToLeft;
                chooseDriverStore.RightToLeftLayout = this.RightToLeftLayout;

                DialogResult result = chooseDriverStore.ShowDialog();

                if (result == DialogResult.OK)
                {
                    switch (chooseDriverStore.StoreType)
                    {
                    case DriverStoreType.Online:
                        this.UpdateDriverStore(DriverStoreFactory.CreateOnlineDriverStore());
                        break;

                    case DriverStoreType.Offline:
                        this.UpdateDriverStore(DriverStoreFactory.CreateOfflineDriverStore(chooseDriverStore.OfflineStoreLocation));
                        break;
                    }

                    await this.PopulateUIWithDriverStoreEntries().ConfigureAwait(true);
                }
            }
        }
Exemple #2
0
        private void ChooseDriverStoreToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (ChooseDriverStore chooseDriverStore = new ChooseDriverStore())
            {
                chooseDriverStore.StoreType = this.driverStore.Type;
                if (this.driverStore.Type == DriverStoreType.Offline)
                {
                    chooseDriverStore.OfflineStoreLocation = this.driverStore.OfflineStoreLocation;
                }

                DialogResult result = chooseDriverStore.ShowDialog();

                if (result == DialogResult.OK)
                {
                    if (!this.backgroundWorker1.IsBusy)
                    {
                        switch (chooseDriverStore.StoreType)
                        {
                        case DriverStoreType.Online:
                            this.UpdateDriverStore(DriverStoreFactory.CreateOnlineDriverStore());
                            break;

                        case DriverStoreType.Offline:
                            this.UpdateDriverStore(DriverStoreFactory.CreateOfflineDriverStore(chooseDriverStore.OfflineStoreLocation));
                            break;
                        }

                        this.PopulateUIWithDriverStoreEntries(true);
                    }
                    else
                    {
                        this.InProgress();
                    }
                }
            }
        }