示例#1
0
        public void click_day(object sender, MouseEventArgs e)
        {
            ListBox   list        = (ListBox)sender;
            int       index       = list.SelectedIndex;
            ActionTab item        = avm.Tabs[actionTabs.SelectedIndex];
            int       index_group = get_group_index(item.Header);

            add_curr_day_new(list.SelectedItem.ToString(), item);
            int up_day_index   = find_day(scheduel[index_group].getUp_rasp(), day_names_locale[index]);
            int down_day_index = find_day(scheduel[index_group].getDown_rasp(), day_names_locale[index]);

            if (up_day_index >= 0 && down_day_index >= 0)
            {
                create_time_list(scheduel[index_group].getUp_rasp()[up_day_index] as Day, scheduel[index_group].getDown_rasp()[down_day_index] as Day, item);
            }
            else if (up_day_index >= 0)
            {
                create_time_list(scheduel[index_group].getUp_rasp()[up_day_index] as Day, item);
            }
            else if (down_day_index >= 0)
            {
                create_time_list(scheduel[index_group].getDown_rasp()[down_day_index] as Day, item);
            }
            else
            {
                create_time_list(new Day(), item);
            }

            //create_time_list(scheduel[index_group].getUp_rasp()[index] as Day, scheduel[index_group].getDown_rasp()[index] as Day, item);
            //create_edit_field(scheduel[index_group].getUp_rasp()[index] as Day, , item);
        }
示例#2
0
        public void create_time_list(Day up, Day down, ActionTab tab)
        {
            ListBox list_b = null;

            if (!time_list.TryGetValue(tab.Header, out list_b))
            {
                ListBox timeList = new ListBox();
                timeList.Margin            = new Thickness(10, 20, 0, 0);
                timeList.Width             = 150;
                timeList.MouseDoubleClick += click_time_new;
                create_context_subject(timeList);
                time_list.Add(tab.Header, timeList);
                (tab.Content as UpControl).add_new(time_list[tab.Header]);
            }

            time_list[tab.Header].Items.Clear();
            Dictionary <string, Subject> down_buff = new Dictionary <string, Subject>();

            foreach (var sub in down.getRasp())
            {
                down_buff.Add(sub.Key, sub.Value);
            }

            foreach (string up_time in up.getRasp().Keys)
            {
                bool find = false;
                foreach (string down_time in down_buff.Keys)
                {
                    if (up_time == down_time)
                    {
                        if (rav(up.getRasp()[up_time], down.getRasp()[down_time]))
                        {
                            time_list[tab.Header].Items.Add(formatter(up_time, "all"));
                            find = true;
                            down_buff.Remove(down_time);
                            break;
                        }
                        else
                        {
                            time_list[tab.Header].Items.Add(formatter(up_time, up.getRasp()[up_time].getType()));
                            time_list[tab.Header].Items.Add(formatter(down_time, down_buff[down_time].getType()));
                            down_buff.Remove(down_time);
                            find = true;
                            break;
                        }
                    }
                }
                if (!find)
                {
                    time_list[tab.Header].Items.Add(formatter(up_time, up.getRasp()[up_time].getType()));
                }
            }
            foreach (string time in down_buff.Keys)
            {
                time_list[tab.Header].Items.Add(formatter(time, down_buff[time].getType()));
            }
        }
示例#3
0
        private void add_curr_day_new(string day, ActionTab item)
        {
            string d;

            if (!curr_day_new.TryGetValue(item.Header, out d))
            {
                curr_day_new.Add(item.Header, day);
            }
            else
            {
                curr_day_new[item.Header] = day;
            }
        }
示例#4
0
        //------new code
        public void click_time_new(object sender, MouseEventArgs e)
        {
            ListBox   list         = (ListBox)sender;
            int       index_select = list.SelectedIndex;
            string    st           = list.SelectedItem as string;
            ActionTab item         = avm.Tabs[actionTabs.SelectedIndex];

            string[] time_unformat = unformatter(st);
            if (time_unformat[1] == "up" || time_unformat[1] == "all")
            {
                int index_day = find_day(scheduel[get_group_index(item.Header)].getUp_rasp(), day_names_locale[Array.IndexOf(day_names, curr_day_new[item.Header])]);
                if (index_day >= 0)
                {
                    Day day = scheduel[get_group_index(item.Header)].getUp_rasp()[index_day] as Day;
                    setup_editor(item, day.getRasp()[time_unformat[0]], time_unformat);
                    string sub_name = day.getRasp()[time_unformat[0]].getName();
                    string time_format;
                    if (!curr_time.TryGetValue(item.Header, out time_format))
                    {
                        curr_time.Add(item.Header, st);
                    }
                    else
                    {
                        curr_time[item.Header] = st;
                    }
                }
            }
            else if (time_unformat[1] == "down")
            {
                int index_day = find_day(scheduel[get_group_index(item.Header)].getDown_rasp(), day_names_locale[Array.IndexOf(day_names, curr_day_new[item.Header])]);
                if (index_day >= 0)
                {
                    Day day = scheduel[get_group_index(item.Header)].getDown_rasp()[index_day] as Day;
                    setup_editor(item, day.getRasp()[time_unformat[0]], time_unformat);
                    string sub_name = day.getRasp()[time_unformat[0]].getName();
                    string time_format;
                    if (!curr_time.TryGetValue(item.Header, out time_format))
                    {
                        curr_time.Add(item.Header, st);
                    }
                    else
                    {
                        curr_time[item.Header] = st;
                    }
                }
            }
            else
            {
                setup_editor(item);
            }
        }
示例#5
0
        private void setup_editor(ActionTab tab)
        {
            editor_com editor = null;

            if (!curr_editor.TryGetValue(tab.Header, out editor))
            {
                editor_com ed = new editor_com();
                ed.Margin = new Thickness(10, 20, 0, 0);
                curr_editor.Add(tab.Header, ed);
                ed.apply_btn.MouseDoubleClick += click_apply_new;
                (tab.Content as UpControl).add_new(curr_editor[tab.Header]);
            }
            curr_editor[tab.Header].clear();
        }
示例#6
0
        private void setup_editor(ActionTab tab, Subject sub, string [] time_unformat)
        {
            editor_com editor = null;

            if (!curr_editor.TryGetValue(tab.Header, out editor))
            {
                editor_com ed = new editor_com();
                ed.Margin = new Thickness(10, 20, 0, 0);
                curr_editor.Add(tab.Header, ed);
                ed.apply_btn.MouseDoubleClick += click_apply_new;
                (tab.Content as UpControl).add_new(curr_editor[tab.Header]);
            }
            curr_editor[tab.Header].set_field(sub.getName(), time_unformat[0], sub.getAud(), sub.getLector());
            curr_editor[tab.Header].check(time_unformat[1]);
        }
示例#7
0
        public void create_time_list(Day day, ActionTab tab)
        {
            ListBox list_b = null;

            if (!time_list.TryGetValue(tab.Header, out list_b))
            {
                ListBox timeList = new ListBox();
                timeList.Margin            = new Thickness(10, 20, 0, 0);
                timeList.Width             = 150;
                timeList.MouseDoubleClick += click_time_new;
                create_context_subject(timeList);
                time_list.Add(tab.Header, timeList);
                (tab.Content as UpControl).add_new(time_list[tab.Header]);
            }
            time_list[tab.Header].Items.Clear();

            foreach (string time in day.getRasp().Keys)
            {
                time_list[tab.Header].Items.Add(formatter(time, day.getRasp()[time].getType()));
            }
        }
示例#8
0
        //----help func
        public void click_apply_new(object sender, MouseEventArgs e)
        {
            ActionTab item = avm.Tabs[actionTabs.SelectedIndex];

            string[] time_un = unformatter(curr_time[item.Header]);
            if (time_un[1] == "up")
            {
                int index_day = find_day(scheduel[get_group_index(item.Header)].getUp_rasp(), day_names_locale[Array.IndexOf(day_names, curr_day_new[item.Header])]);
                (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day] as Day).getRasp()[time_un[0]].setName(curr_editor[item.Header].name_box.Text);
                (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day] as Day).getRasp()[time_un[0]].setAud(curr_editor[item.Header].aud_box.Text);
                (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day] as Day).getRasp()[time_un[0]].setLector(curr_editor[item.Header].lector_box.Text);

                Subject buffer = (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day] as Day).getRasp()[time_un[0]];
                (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day] as Day).getRasp().Remove(time_un[0]);
                (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day] as Day).getRasp().Add(curr_editor[item.Header].time_box.Text, buffer);
                time_list[item.Header].Items.Remove(curr_time[item.Header]);
                curr_time[item.Header] = formatter(curr_editor[item.Header].time_box.Text, curr_editor[item.Header].get_selected_type());
                time_list[item.Header].Items.Add(curr_time[item.Header]);
                setup_editor(item, (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day] as Day).getRasp()[unformatter(curr_time[item.Header])[0]], unformatter(curr_time[item.Header]));
            }
            else if (time_un[1] == "down")
            {
                int index_day = find_day(scheduel[get_group_index(item.Header)].getDown_rasp(), day_names_locale[Array.IndexOf(day_names, curr_day_new[item.Header])]);
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day] as Day).getRasp()[time_un[0]].setName(curr_editor[item.Header].name_box.Text);
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day] as Day).getRasp()[time_un[0]].setAud(curr_editor[item.Header].aud_box.Text);
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day] as Day).getRasp()[time_un[0]].setLector(curr_editor[item.Header].lector_box.Text);

                Subject buffer = (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day] as Day).getRasp()[time_un[0]];
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day] as Day).getRasp().Remove(time_un[0]);
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day] as Day).getRasp().Add(curr_editor[item.Header].time_box.Text, buffer);
                time_list[item.Header].Items.Remove(curr_time[item.Header]);
                curr_time[item.Header] = formatter(curr_editor[item.Header].time_box.Text, curr_editor[item.Header].get_selected_type());
                time_list[item.Header].Items.Add(curr_time[item.Header]);
                setup_editor(item, (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day] as Day).getRasp()[unformatter(curr_time[item.Header])[0]], unformatter(curr_time[item.Header]));
            }
            else if (time_un[1] == "all")
            {
                int index_day_up   = find_day(scheduel[get_group_index(item.Header)].getUp_rasp(), day_names_locale[Array.IndexOf(day_names, curr_day_new[item.Header])]);
                int index_day_down = find_day(scheduel[get_group_index(item.Header)].getDown_rasp(), day_names_locale[Array.IndexOf(day_names, curr_day_new[item.Header])]);

                //up
                (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day_up] as Day).getRasp()[time_un[0]].setName(curr_editor[item.Header].name_box.Text);
                (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day_up] as Day).getRasp()[time_un[0]].setAud(curr_editor[item.Header].aud_box.Text);
                (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day_up] as Day).getRasp()[time_un[0]].setLector(curr_editor[item.Header].lector_box.Text);

                //down
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day_down] as Day).getRasp()[time_un[0]].setName(curr_editor[item.Header].name_box.Text);
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day_down] as Day).getRasp()[time_un[0]].setAud(curr_editor[item.Header].aud_box.Text);
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day_down] as Day).getRasp()[time_un[0]].setLector(curr_editor[item.Header].lector_box.Text);

                Subject buffer = (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day_down] as Day).getRasp()[time_un[0]];
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day_down] as Day).getRasp().Remove(time_un[0]);
                (scheduel[get_group_index(item.Header)].getDown_rasp()[index_day_down] as Day).getRasp().Add(curr_editor[item.Header].time_box.Text, buffer);
                time_list[item.Header].Items.Remove(curr_time[item.Header]);
                curr_time[item.Header] = formatter(curr_editor[item.Header].time_box.Text, "all");
                time_list[item.Header].Items.Add(curr_time[item.Header]);
                setup_editor(item, (scheduel[get_group_index(item.Header)].getUp_rasp()[index_day_up] as Day).getRasp()[unformatter(curr_time[item.Header])[0]], unformatter(curr_time[item.Header]));
            }

            save("temp\\temp.up");
            MessageBox.Show("Apply");
        }
示例#9
0
 public int get_index(ActionTab tab)
 {
     return(Tabs.IndexOf(tab));
 }