コード例 #1
0
ファイル: MainForm.cs プロジェクト: KunHsiang/ischedule
        /// <summary>
        /// 上傳資料
        /// </summary>
        public void Upload()
        {
            try
            {
                if (!Global.IsValidatePassport())
                {
                    frmLogin frmLogin = new frmLogin();

                    if (frmLogin.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                        return;
                }

                frmUploadConfirm frmUploadConfirm = new frmUploadConfirm();

                List<string> DSNSNames = SchedulerSource.Source.DSNSNames;

                if (frmUploadConfirm.TestConnection(DSNSNames) == DialogResult.OK)
                {
                    Tuple<bool, string> UploadResult = schLocal.Upload(frmUploadConfirm.Connections);

                    if (UploadResult.Item1)
                    {
                        MessageBox.Show(UploadResult.Item2, "上傳成功!");
                    }
                    else
                    {
                        MessageBox.Show(UploadResult.Item2, "上傳失敗= =");
                    }
                }
            }
            catch (Exception ve)
            {
                MessageBox.Show(ve.Message);
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: KunHsiang/ischedule
        private void btnLogin_Click(object sender, EventArgs e)
        {
            frmLogin frmLogin = new frmLogin();

            if (frmLogin.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {

            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: KunHsiang/ischedule
        /// <summary>
        /// 下載資料
        /// </summary>
        public void Download()
        {
            if (!Global.IsValidatePassport())
            {
                frmLogin frmLogin = new frmLogin();

                if (frmLogin.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                    return;
            }

            frmTestConnection frmTestConnection = new frmTestConnection();

            if (frmTestConnection.TestConnection() == System.Windows.Forms.DialogResult.OK)
            {
                List<Connection> Connections = frmTestConnection.Connections;
                string SchoolYear = frmTestConnection.SchoolYear;
                string Semester = frmTestConnection.Semester;

                try
                {
                    schLocal.Download(Connections, SchoolYear, Semester);

                    frmDownloadConfirm frmDownloadConfirm = new frmDownloadConfirm();

                    if (frmDownloadConfirm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        schLocal.Import();

                        string SaveFilename = "ischedule_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".sch";

                        schLocal.SaveByBase64(SaveFilename,"1234");

                        LoadResourceList();
                    }
                    else
                        SchedulerSource.Source.Close();
                }
                catch (Exception ve)
                {
                    MessageBox.Show(ve.Message);
                }
            }
        }