Пример #1
0
        void Time1_Elapsed(object sender, ElapsedEventArgs e)
        {
            string[] dayslist = null;
            mctrl.DetermineDaysInMonth(ref dayslist);
            mctrl.PrepareDataJSONForTransmission(dayslist);

            if ((string)mctrl.GetReadDataJSONObject() != string.Empty)
            {
                mctrl.AddInfosIntoTheCalendar(dayslist, mctrl.parseDataJSONString((string)mctrl.GetReadDataJSONObject()));
                mctrl.SetReadDataJSON("");
            }

            if ((string)mctrl.GetReadEatingPlanJSONObject() != string.Empty)
            {
                //string testjson = "{{\"sender\":\"10.122.122.110\",\"port\":9010,\"reason\":\"ReceiveEatingPlanData\"},{\"EatingItemDate\":\"2019 - 02 - 04T00: 00:00\",\"EatingItemDescription\":\"Essen1\"},{\"EatingItemDate\":\"2019 - 02 - 05T00: 00:00\",\"EatingItemDescription\":\"Essen2\"},{\"EatingItemDate\":\"2019 - 02 - 06T00: 00:00\",\"EatingItemDescription\":\"Essen3\"},{\"EatingItemDate\":\"2019 - 02 - 07T00: 00:00\",\"EatingItemDescription\":\"Essen4\"},{\"EatingItemDate\":\"2019 - 02 - 08T00: 00:00\",\"EatingItemDescription\":\"Essen5\"}}";
                //mctrl.eatingItemList = new MainModel.EatingItemList(new System.Collections.ObjectModel.ObservableCollection<MainModel.EatingItem>(mctrl.parseEatingPlanJSONString(testjson)));
                mctrl.eatingItemList = new MainModel.EatingItemList
                                       (
                    new System.Collections.ObjectModel.ObservableCollection <MainModel.EatingItem>
                    (
                        mctrl.parseEatingPlanJSONString(mctrl.GetReadEatingPlanJSON())
                    )
                                       );
                ViewsConstructor.SetEatingPlanItemsSource(mctrl.ctrlList);
                mctrl.SetReadEatingPlanJSON("");
            }

            mctrl.GetThreadEndingFlag()[1] = true;
            mctrl.GetThreadEndingFlag()[2] = true;
            mctrl.GetThreadEndingFlag()[1] = false;
            mctrl.GetThreadEndingFlag()[2] = false;
            //Console.WriteLine("Timer Event " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second);
            mctrl.StartThread(1, mctrl.GetWriteDataJSONObject(), mctrl.GetReadDataJSONObject());
            mctrl.PrepareEatingPlanJSONForTransmission();
            mctrl.StartThread(2, mctrl.GetWriteEatingPlanJSONObject(), mctrl.GetReadEatingPlanJSONObject());
            time1.Interval = 60000;
            time1.Start();
        }
Пример #2
0
 void Btn_EatingPlan_Click(object sender, RoutedEventArgs e)
 {
     ViewsConstructor.ShowEatingPlan(mctrl.ctrlList);
 }
Пример #3
0
 void OnCellMouseEnter(object sender, MouseEventArgs e)
 {
     hoveredcell = (TextBlock)sender;
     ViewsConstructor.ShowMeetingPanel(mctrl.ctrlList);
 }
Пример #4
0
 void OnCellMouseLeave(object sender, MouseEventArgs e)
 {
     ViewsConstructor.HideMeetingPanel(mctrl.ctrlList);
 }
Пример #5
0
        void IMeetingPanelView.ShowView()
        {
            if (!mp.IsVisible)
            {
                ExternFunctions.POINT mousepos = new ExternFunctions.POINT();
                ExternFunctions.GetCursorPos(out mousepos);
                mp.Left = mousepos.X;
                mp.Top  = mousepos.Y;
                ArrayList templist = mctrl.GetAllDays();
                List <MainModel.JSONItem> markeditems = new List <MainModel.JSONItem>();
                string tempmeeting     = "";
                string hoveredcelltext = ViewsConstructor.GetMainWindowController(mctrl.ctrlList).hoveredcell.Text.Substring(0, 1);

                foreach (object item in templist)
                {
                    if (item.GetType() != typeof(MainModel.JSONHeader) && ((MainModel.JSONItem)item).meeting != null)
                    {
                        markeditems.Add((MainModel.JSONItem)item);
                    }
                }

                templist = null;

                foreach (MainModel.JSONItem item in markeditems)
                {
                    tempmeeting = "";

                    foreach (MainModel.MeetingObject meeting in item.meeting)
                    {
                        if
                        (
                            item.meeting.Count > 5
                        )
                        {
                            if (meeting != item.meeting.ElementAt(5))
                            {
                                if (hoveredcelltext == item.date.Day.ToString())
                                {
                                    tempmeeting += meeting.time.ToShortTimeString() + " : " + meeting.subject + "\n";
                                }
                            }
                            else
                            {
                                tempmeeting += "...\n";
                            }
                        }
                        else
                        {
                            if (hoveredcelltext == item.date.Day.ToString())
                            {
                                tempmeeting += meeting.time.ToShortTimeString() + " : " + meeting.subject + "\n";
                            }
                        }
                    }

                    if (hoveredcelltext == item.date.Day.ToString())
                    {
                        mp.TB_Meeting.Text = tempmeeting;
                    }
                }
            }

            mp.Show();
        }