Ejemplo n.º 1
0
        private void add_Click(object sender, EventArgs e)
        {
            Dictionary <int, List <Event> >            mEvents = new Dictionary <int, List <Event> >();
            SaveXML <Dictionary <int, List <Event> > > saver   = new SaveXML <Dictionary <int, List <Event> > >();

            if (File.Exists(Form1.eventFileName))
            {
                mEvents = saver.GetData(mEvents, Form1.eventFileName);
            }

            List <Event> eventslist = new List <Event>();

            if (mEvents.ContainsKey(selectedDate.Text.ToString().GetHashCode()))
            {
                eventslist = mEvents[selectedDate.Text.ToString().GetHashCode()];
            }

            eventslist.Add(new Event(eventTitle.Text, eventLocation.Text, hourTxt.Text + ":" + minuteTxt.Text + " " + am_pm.Text, selectedDate.Text));

            mEvents.Remove(selectedDate.Text.ToString().GetHashCode());

            mEvents.Add(selectedDate.Text.ToString().GetHashCode(), eventslist);

            saver.SaveData(mEvents, Form1.eventFileName);
        }
Ejemplo n.º 2
0
        /**
         * 保存数据
         */
        public void SaveEventData()
        {
            SaveXML <Dictionary <int, List <Event> > > saver = new SaveXML <Dictionary <int, List <Event> > >();

            saver.SaveData(mEvents, mEventFile);
        }