Exemplo n.º 1
0
        private void SetThread()
        {
            IExporter      exporter      = new CanterburyExporter();
            ILoginRequired loginRequired = exporter as ILoginRequired;

            if (loginRequired != null)
            {
                ModifyList("Logging In...");
                var loginHandle = loginRequired.CreateNewLoginHandle();
                var login       = new FormLogin(ref loginHandle, "Export Timetable");
                login.ShowDialog();
                loginRequired.SetLoginHandle(ref loginHandle);
            }

            var res = exporter.Export(_timetable, ModifyList);

            if (!res)
            {
                MessageBox.Show(
                    "One or more errors occured while setting the desired timetable.\nPlease review the log for details.",
                    "Error(s)", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            ModifyList("Complete!");
            EnableOkButton();
        }
        private void Import()
        {
            ILoginRequired loginRequired = _importer as ILoginRequired;

            if (loginRequired != null)
            {
                var loginHandle = loginRequired.CreateNewLoginHandle();
                var login       = new FormLogin(ref loginHandle, "Import Timetable");
                var result      = login.ShowDialog();
                if (result == DialogResult.Cancel)
                {
                    DialogResult = DialogResult.Cancel;
                }
                loginRequired.SetLoginHandle(ref loginHandle);
            }
            else
            {
                DialogResult = DialogResult.OK;
            }

            if (DialogResult == DialogResult.Cancel)
            {
                Close();
                return;
            }

            _importerThread.Start();
        }