Esempio n. 1
0
        private void btnQGen_Click(object sender, RoutedEventArgs e)
        {
            Op0SlotView vw = tbcSl.SelectedItem as Op0SlotView;

            if (vw == null)
            {
                return;
            }
            ExamLv lv;

            if (rdoA.IsChecked.HasValue ? rdoA.IsChecked.Value : false)
            {
                lv = ExamLv.A;
            }
            else
            {
                lv = ExamLv.B;
            }
            int[] vnesydif = new int[vtxtNEsyDif[lv].Length];
            int[] vndiff   = new int[vnesydif.Length];
            for (int i = 0; i < vnesydif.Length; ++i)
            {
                vnesydif[i] = int.Parse(vtxtNEsyDif[lv][i].Text);
                if (!int.TryParse(vtxtNDiff[lv][i].Text, out vndiff[i]))
                {
                    vndiff[i] = 0;
                }
            }
            vw.GenQ(lv, vnesydif, vndiff);
        }
Esempio n. 2
0
        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            foreach (TabItem i in tbcSl.Items)
            {
                Op0SlotView vw = i as Op0SlotView;
                if (vw == null)
                {
                    continue;
                }
                if (vw.mSl.eStt == ExamStt.Prep)
                {
                    vw.mSl.eStt = ExamStt.Oper;
                    vw.mSl.DBUpStt();
                }
            }
            DisableQSGen();
            Thread th = new Thread(() => { mServer.Start(ref mCbMsg); });

            th.Start();
            btnStop.IsEnabled   = true;
            btnStop.Foreground  = Theme.s._[(int)BrushId.FG];
            btnStop.Background  = Theme.s._[(int)BrushId.mReconn];
            btnStart.IsEnabled  = false;
            btnStart.Foreground = Theme.s._[(int)BrushId.FG_Gray];
            btnStart.Background = Theme.s._[(int)BrushId.BG_Gray];
        }
Esempio n. 3
0
        private void lbxSl_Selected(object sender, RoutedEventArgs e)
        {
            ListBoxItem i = sender as ListBoxItem;

            if (i == null)
            {
                return;
            }
            if (mBrd.vSl.ContainsKey(i.Content as string))
            {
                return;
            }

            ExamSlot sl = new ExamSlot();
            DateTime dt;

            DT.To_(mBrd.mDt.ToString(DT._) + ' ' + i.Content as string, DT.H, out dt);
            sl.Dt = dt;
            string emsg;

            if ((emsg = sl.DBSelRoomId()) != null)
            {
                WPopup.s.ShowDialog(emsg);
                return;
            }
            sl.DBSelStt();
            sl.DBSelQPkR();
            sl.DBSelNee();
            if (sl.DBSelArchieve(out emsg))
            {
                WPopup.s.ShowDialog(emsg);
                return;
            }
            Op0SlotView tbi = new Op0SlotView(sl);

            tbi.DeepCopy(tbcRefSl);
            tbi.ShowExaminee();
            tbi.ShowQSHeader();
            tbcSl.Items.Add(tbi);
            QuestSheet.DBUpdateCurQSId(mBrd.mDt);
            mBrd.vSl.Add(i.Content as string, sl);
            if ((tbi = tbcSl.SelectedItem as Op0SlotView) != null &&
                tbi.mSl.eStt == ExamStt.Prep)
            {
                EnableQSGen();
            }
            else
            {
                DisableQSGen();
            }
        }
Esempio n. 4
0
        private void tbcSl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl tbc = sender as TabControl;

            if (tbc == null)
            {
                return;
            }
            TabItem tbi = tbc.SelectedItem as TabItem;

            if (tbi == null || tbiSelected == tbi)
            {
                return;
            }
            tbiSelected = tbi;
            Op0SlotView vw = tbi as Op0SlotView;

            if (vw == null)
            {
                rdoA.IsEnabled         =
                    rdoB.IsEnabled     = grdA.IsEnabled =
                        grdB.IsEnabled = false;
                return;
            }
            vw.InitNMod();
            rdoA.IsEnabled     = rdoB.IsEnabled =
                grdA.IsEnabled = grdB.IsEnabled = true;
            rdoA.IsChecked     = true;
            ExamLv       lv   = ExamLv.A;
            List <int[]> nmod = vw.GetNMod(lv);

            if (nmod != null && nmod.Count == 2)
            {
                int i = -1;
                foreach (TextBox t in vtxtNEsyDif[lv])
                {
                    t.Text = nmod[0][++i].ToString();
                }
                i = -1;
                foreach (TextBox t in vtxtNDiff[lv])
                {
                    t.Text = nmod[1][++i].ToString();
                }
            }
            else
            {
                foreach (TextBox t in vtxtNEsyDif[lv])
                {
                    t.Text = string.Empty;
                }
                foreach (TextBox t in vtxtNDiff[lv])
                {
                    t.Text = string.Empty;
                }
            }
            lv   = ExamLv.B;
            nmod = vw.GetNMod(lv);
            if (nmod != null && nmod.Count == 4)
            {
                int i = -1;
                foreach (TextBox t in vtxtNEsyDif[lv])
                {
                    t.Text = nmod[0][++i].ToString();
                }
                i = -1;
                foreach (TextBox t in vtxtNDiff[lv])
                {
                    t.Text = nmod[1][++i].ToString();
                }
            }
            else
            {
                foreach (TextBox t in vtxtNEsyDif[lv])
                {
                    t.Text = string.Empty;
                }
                foreach (TextBox t in vtxtNDiff[lv])
                {
                    t.Text = string.Empty;
                }
            }
            if ((vw = tbcSl.SelectedItem as Op0SlotView) != null &&
                vw.mSl.eStt == ExamStt.Prep)
            {
                EnableQSGen();
            }
            else
            {
                DisableQSGen();
            }
        }