예제 #1
0
        void BeforeStartJob(object o)
        {
            this.txtInfo.Text = InfoUtil.GetInfoAA((Dictionary <string, string>)o) + InfoUtil.GetInfoProject((Dictionary <string, string>)o);

            this.txtInfo.SelectionStart  = 0;
            this.txtInfo.SelectionLength = 0;
        }
        public DialogResult ChkConfig(string filename)
        {
            this.cm.SetConfig(this.fconfig.Config);

            string baseDir = new FileInfo(filename).Directory.FullName + "\\AsciiArt";

            if (this.cm.SizeType == 0)
            {
                baseDir = baseDir + "\\no_zoom";
            }
            else
            {
                baseDir = baseDir + "\\" + this.cm.SizeImage.Width + "x" + this.cm.SizeImage.Height;
            }

            if (!File.Exists(baseDir + "\\info.txt"))
            {
                return(DialogResult.OK);
            }

            string infoAA = InfoUtil.GetInfoAA(this.cm.ConfigDic);

            string oldInfoAA = "";

            using (StreamReader sr = new StreamReader(baseDir + "\\info.txt"))
            {
                oldInfoAA = sr.ReadToEnd();
            }

            if (infoAA == oldInfoAA)
            {
                return(DialogResult.OK);
            }

            using (FrmChkAAInfo f = new FrmChkAAInfo(oldInfoAA, infoAA))
            {
                f.ShowDialog(this.fmain);

                if (f.IsConfigOpen)
                {
                    this.fconfig.OpenConfig(baseDir + "\\config.ini");
                }

                if (f.IsOK)
                {
                    return(DialogResult.OK);
                }
            }

            return(DialogResult.Cancel);
        }
        public void SaveConfig(string filename)
        {
            this.cm.SetConfig(this.fconfig.Config);

            string baseDir = new FileInfo(filename).Directory.FullName + "\\AsciiArt";

            if (!Directory.Exists(baseDir))
            {
                Directory.CreateDirectory(baseDir);
            }

            if (this.cm.SizeType == 0)
            {
                if (!Directory.Exists(baseDir + "\\no_zoom"))
                {
                    Directory.CreateDirectory(baseDir + "\\no_zoom");
                }
                baseDir = baseDir + "\\no_zoom";
            }
            else
            {
                if (!Directory.Exists(baseDir + "\\" + this.cm.SizeImage.Width + "x" + this.cm.SizeImage.Height))
                {
                    Directory.CreateDirectory(baseDir + "\\" + this.cm.SizeImage.Width + "x" + this.cm.SizeImage.Height);
                }
                baseDir = baseDir + "\\" + this.cm.SizeImage.Width + "x" + this.cm.SizeImage.Height;
            }

            this.fconfig.SaveConfig(baseDir + "\\config.ini");

            string infoAA = InfoUtil.GetInfoAA(this.cm.ConfigDic);

            using (StreamWriter sw = new StreamWriter(baseDir + "\\info.txt"))
            {
                sw.Write(infoAA);
            }
        }
예제 #4
0
 private void BTNback_Click(object sender, RoutedEventArgs e)
 {
     InfoUtil.BackRequest();
 }
예제 #5
0
        private async void LSTVWinfo_ItemClick(object sender, ItemClickEventArgs e)
        {
            switch ((e.ClickedItem as UsualItemData).ID)
            {
            case 0:
            {
                FRAMEdetail.Navigate(typeof(ImageShowPage), new Parameters("北大地图", "ms-appx:///Assets/pkumap.jpg"));
                if (VSGinfo.CurrentState == narrow)
                {
                    UpdateVisualState(narrow, null);
                }
            } break;

            case 1:
            {
                FRAMEdetail.Navigate(typeof(ImageShowPage), new Parameters("北京地铁图", "ms-appx:///Assets/subwaymap.jpg"));
                if (VSGinfo.CurrentState == narrow)
                {
                    UpdateVisualState(narrow, null);
                }
            } break;

            case 2:
            {
                PRGRSinfo.ProgressStart();
                await InfoUtil.GetCardAmount();

                PRGRSinfo.ProgressEnd();
            } break;

            case 3:
            {
                first : BitmapImage bmp = new BitmapImage();
                Stream stream = await WebConnection.Connect_for_stream("http://dean.pku.edu.cn/student/yanzheng.php?act=init");

                if (stream == null)
                {
                    Constants.BoxPage.ShowMessage("获取验证码失败!");
                    return;
                }
                var ran_stream = await Util.StreamToRandomAccessStream(stream);

                bmp.SetSource(ran_stream);

                IMGverify.Source = bmp;
                if (DLGshowing)
                {
                    return;
                }
                ContentDialogResult res = await DLGverify.ShowAsync();

                if (res == ContentDialogResult.Primary)
                {
                    String phpsessid = await Dean.get_session_id(verifyCode);

                    if (phpsessid == "")
                    {
                        goto first;
                    }
                    PRGRSinfo.ProgressStart();
                    Parameters parameters = await WebConnection.Connect(Constants.domain + "/services/pkuhelper/allGrade.php?phpsessid=" + phpsessid, null);

                    if (parameters.name != "200")
                    {
                        Util.DealWithDisconnect(parameters);
                        PRGRSinfo.ProgressEnd();
                    }
                    else
                    {
                        PRGRSinfo.ProgressEnd();
                        FRAMEdetail.Navigate(typeof(GradePage), parameters.value);
                        if (VSGinfo.CurrentState == narrow)
                        {
                            UpdateVisualState(narrow, null);
                        }
                    }
                }
            } break;

            case 4:
            {
                FRAMEdetail.Navigate(typeof(SchoolCalendarPage));
                if (VSGinfo.CurrentState == narrow)
                {
                    UpdateVisualState(narrow, null);
                }
            }
            break;

            case 5:
            {
                FRAMEdetail.Navigate(typeof(PhoneList));
                if (VSGinfo.CurrentState == narrow)
                {
                    UpdateVisualState(narrow, null);
                }
            }
            break;
            }
        }