Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            bool CanAddFlag = true;

            if (G.glb.lstEvent.Exists(o => o.TagTime == curDate && o.EventName == txtEvent.Text))
            {
                MessageBox.Show("Can not add two event in the same name at the same day.");
                CanAddFlag = false;
            }

            if (CanAddFlag)
            {
                CEvent newEvent = new CEvent();
                newEvent.EventName = txtEvent.Text;
                newEvent.TagTime   = dtpDate.Value.Date;
                switch (cbxEventState.Text)
                {
                case "Log Event":
                    newEvent.EventState = EEventState.LogEvent;
                    break;

                case "Succeed":
                    newEvent.EventState = EEventState.Succeed;
                    break;

                case "Failed":
                    newEvent.EventState = EEventState.Failed;
                    break;

                default:
                    break;
                }
                G.glb.lstEvent.Add(newEvent);
                DrawLog();
                Dispose();
            }
        }
Пример #2
0
 public frmInfoEvent(CEvent info)
 {
     InitializeComponent();
     eve = info;
     lblEventName.Text = eve.EventName;
     if (eve.EventState == EEventState.Succeed)
     {
         tlpEvent.BackColor = Color.Green;
         lblSucceed.Text    = "Succeed";
     }
     else if (eve.EventState == EEventState.Failed)
     {
         tlpEvent.BackColor = Color.Red;
         lblSucceed.Text    = "Failed";
     }
     else if (eve.EventState == EEventState.LogEvent)
     {
         tlpEvent.BackColor = Color.Gray;
         lblSucceed.Text    = "Log Event";
     }
     timer.Interval = 10000;
     timer.Start();
     timer.Tick += Timer_Tick;
 }
Пример #3
0
        public void CallInfoEvent(CEvent info)
        {
            frmInfoEvent frmInfoEvent = new frmInfoEvent(info);

            frmInfoEvent.Show();
        }
Пример #4
0
        public void DrawEventController(
            PictureBox picMap,
            DateTime date,
            List <CEvent> events,
            List <CWorkOut> workOuts,
            List <CMedicine> medicines,
            List <CTransaction> transactions,
            List <CTransaction> budgets,
            List <CNote> notes)
        {
            int left = picMap.Width - 27 > 0 ? picMap.Width - 27 : 0;
            List <PictureBox>   lstPicEvent    = new List <PictureBox>();
            List <CEvent>       lstEvent       = events.FindAll(o => o.TagTime.Date == date).ToList();
            List <CWorkOut>     lstWorkOut     = workOuts.FindAll(o => o.TagTime.Date == date).ToList();
            List <CMedicine>    lstMedicine    = medicines.FindAll(o => o.TagTime.Date == date).ToList();
            List <CTransaction> lstTransaction = transactions.FindAll(o => o.TagTime.Date == date).ToList();
            List <CTransaction> lstBudget      = budgets.FindAll(o => o.TagTime.Date == date).ToList();
            List <CNote>        lstNote        = notes.FindAll(o => o.TagTime.Date == date).ToList();
            int acc = 0;

            for (int i = 0; i < lstEvent.Count; i++)
            {
                lstPicEvent.Add(new PictureBox());
                CEvent eve = lstEvent[i];
                if (lstEvent[i].EventState == EEventState.LogEvent)
                {
                    lstPicEvent[i].Image = icon.iconEvent;
                }
                else if (lstEvent[i].EventState == EEventState.Succeed)
                {
                    lstPicEvent[i].Image = icon.iconSucceedEvent;
                }
                else
                {
                    lstPicEvent[i].Image = icon.iconFailedEvent;
                }
                lstPicEvent[i].Top    = i * 30 + 3;
                lstPicEvent[i].Left   = left;
                lstPicEvent[i].Width  = 24;
                lstPicEvent[i].Height = 24;
                lstPicEvent[i].Click += (e, a) => CallInfoEvent(eve);
                picMap.Controls.Add(lstPicEvent[i]);
            }
            acc = acc + lstEvent.Count;
            for (int i = 0; i < lstWorkOut.Count; i++)
            {
                lstPicEvent.Add(new PictureBox());
                CWorkOut workOut = lstWorkOut[i];
                lstPicEvent[i + acc].Image  = icon.iconFitness;
                lstPicEvent[i + acc].Top    = (i + acc) * 30 + 3;
                lstPicEvent[i + acc].Left   = left;
                lstPicEvent[i + acc].Width  = 24;
                lstPicEvent[i + acc].Height = 24;
                lstPicEvent[i + acc].Click += (e, a) => CallInfoWorkOut(workOut);
                picMap.Controls.Add(lstPicEvent[i + acc]);
            }
            acc = acc + lstWorkOut.Count;
            for (int i = 0; i < lstMedicine.Count; i++)
            {
                lstPicEvent.Add(new PictureBox());
                CMedicine medicine = lstMedicine[i];
                lstPicEvent[i + acc].Image  = icon.iconHealth;
                lstPicEvent[i + acc].Top    = (i + acc) * 30 + 3;
                lstPicEvent[i + acc].Left   = left;
                lstPicEvent[i + acc].Width  = 24;
                lstPicEvent[i + acc].Height = 24;
                lstPicEvent[i + acc].Click += (e, a) => CallInfoMedicine(medicine);
                picMap.Controls.Add(lstPicEvent[i + acc]);
            }
            acc = acc + lstMedicine.Count;
            for (int i = 0; i < lstTransaction.Count; i++)
            {
                lstPicEvent.Add(new PictureBox());
                CTransaction    transaction    = lstTransaction[i];
                EMoneyFlowState MoneyFlowState = lstTransaction[i].IconType;
                switch (MoneyFlowState)
                {
                case EMoneyFlowState.WithinSystem:
                    lstPicEvent[i + acc].Image = icon.iconMoneyWithin;
                    break;

                case EMoneyFlowState.FlowIn:
                    lstPicEvent[i + acc].Image = icon.iconMoneyIn;
                    break;

                case EMoneyFlowState.FlowOut:
                    lstPicEvent[i + acc].Image = icon.iconMoneyOut;
                    break;

                default:
                    break;
                }
                lstPicEvent[i + acc].Top    = (i + acc) * 30 + 3;
                lstPicEvent[i + acc].Left   = left;
                lstPicEvent[i + acc].Width  = 24;
                lstPicEvent[i + acc].Height = 24;
                lstPicEvent[i + acc].Click += (e, a) => CallInfoTransaction(transaction);
                picMap.Controls.Add(lstPicEvent[i + acc]);
            }
            acc = acc + lstTransaction.Count;
            for (int i = 0; i < lstBudget.Count; i++)
            {
                lstPicEvent.Add(new PictureBox());
                CTransaction    transactionDue = lstBudget[i];
                EMoneyFlowState MoneyFlowState = lstBudget[i].IconType;
                switch (MoneyFlowState)
                {
                case EMoneyFlowState.WithinSystem:
                    lstPicEvent[i + acc].Image = icon.iconTransactionDueWithin;
                    break;

                case EMoneyFlowState.FlowIn:
                    lstPicEvent[i + acc].Image = icon.iconTransactionDueIn;
                    break;

                case EMoneyFlowState.FlowOut:
                    lstPicEvent[i + acc].Image = icon.iconTransactionDueOut;
                    break;

                default:
                    break;
                }
                lstPicEvent[i + acc].Top    = (i + acc) * 30 + 3;
                lstPicEvent[i + acc].Left   = left;
                lstPicEvent[i + acc].Width  = 24;
                lstPicEvent[i + acc].Height = 24;
                lstPicEvent[i + acc].Click += (e, a) => CallInfoBudget(transactionDue);
                picMap.Controls.Add(lstPicEvent[i + acc]);
            }
            acc = acc + lstBudget.Count;
            for (int i = 0; i < lstNote.Count; i++)
            {
                lstPicEvent.Add(new PictureBox());
                CNote note = lstNote[i];
                if (lstNote[i].FinishedNote)
                {
                    if (lstNote[i].LiteratureTitle != "")
                    {
                        lstPicEvent[i + acc].Image = icon.iconLiterature;
                    }
                    else
                    {
                        lstPicEvent[i + acc].Image = icon.iconNote;
                    }
                }
                else
                {
                    lstPicEvent[i + acc].Image = icon.iconWorkingNote;
                }
                lstPicEvent[i + acc].Top    = (i + acc) * 30 + 3;
                lstPicEvent[i + acc].Left   = left;
                lstPicEvent[i + acc].Width  = 24;
                lstPicEvent[i + acc].Height = 24;
                lstPicEvent[i + acc].Click += (e, a) => CallInfoNote(note);
                picMap.Controls.Add(lstPicEvent[i + acc]);
            }
            acc = acc + lstNote.Count;
        }