Exemple #1
0
        private void UpdateInfo()
        {
            var client = new Client();

            classInfo.Lesson.Clear();
            classInfo.Lesson = client.GetClassInfo();

            var chooseId = client.GetChoosedClass(Token, UserName);

            choosedClass.Lesson.Clear();
            foreach (var id in chooseId)
            {
                classInfo.SetIsChoose(id, true);
                var lesson = classInfo.GetClassInfo(id);
                if (lesson == null)
                {
                    return;
                }
                choosedClass.Lesson.Add(lesson.Copy());
            }

            ClassChosser.BeginUpdate();

            classInfo.SetListView(ClassChosser);

            ClassChosser.EndUpdate();

            ChoosedLesson.BeginUpdate();

            choosedClass.SetListView(ChoosedLesson);

            ChoosedLesson.EndUpdate();
        }
Exemple #2
0
        private void MainActivity_Load(object sender, EventArgs e)
        {
            var login = new Login();

            while (!login.IsQuit)
            {
                login.ShowDialog();
            }

            if (!login.LoginSuccess)
            {
                this.Close();
                return;
            }
            this.Token    = login.Token;
            this.UserName = login.UserName;
            this.ClassChosser.FullRowSelect = true;

            classInfo    = new Platform();
            choosedClass = new Platform();

            var client = new Client();

            classInfo        = new Platform();
            classInfo.Lesson = client.GetClassInfo();

            var chooseId = client.GetChoosedClass(Token, UserName);

            if (chooseId != null)
            {
                foreach (var id in chooseId)
                {
                    classInfo.SetIsChoose(id, true);
                    var lesson = classInfo.GetClassInfo(id);
                    if (lesson == null)
                    {
                        return;
                    }


                    choosedClass.Lesson.Add(lesson.Copy());
                }
                ChoosedLesson.BeginUpdate();

                choosedClass.SetListView(ChoosedLesson);

                ChoosedLesson.EndUpdate();
            }



            if (classInfo.Lesson == null)
            {
                MessageBox.Show("网络连接失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return;
            }

            this.ClassChosser.BeginUpdate();

            //lesson = new ListViewItem();

            classInfo.SetListView(ClassChosser);

            /*lesson.Text = "I666666666";
             * lesson.SubItems.Add("装逼学");
             * lesson.SubItems.Add("炮王");
             * lesson.SubItems.Add("999/999");
             * this.ClassChosser.Items.Add(lesson);*/

            this.ClassChosser.EndUpdate();
        }