Exemplo n.º 1
0
 private void 既存のタイマーToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ofd             = new OpenFileDialog();
     ofd.Multiselect = true;
     ofd.Filter      = "XMLファイル(*.xml)|*.xml|すべてのファイル(*.*)|*.*";
     if (ofd.ShowDialog() == DialogResult.OK)
     {
         try
         {
             for (int i = 0; i < ofd.FileNames.Length; i++)
             {
                 TimeSet       _TimeSet    = new TimeSet();
                 XmlSerializer _serializer = new XmlSerializer(typeof(LoadTimeSet));
                 StreamReader  sr          = new StreamReader(ofd.FileNames[i], new System.Text.UTF8Encoding(false));
                 LoadTimeSet   newTimeSet  = (LoadTimeSet)_serializer.Deserialize(sr);
                 sr.Close();
                 SetTimer(newTimeSet.tName, newTimeSet.tMaxLP, newTimeSet.tCurrrentLP, newTimeSet.tRecoverCycle, out _TimeSet.tName, out _TimeSet.tHour, out _TimeSet.tMinute, out _TimeSet.tSecond, out _TimeSet.tDate);
                 CreatetForm(_TimeSet);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, ex.Message, "Nortification", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemplo n.º 2
0
        private void buttonCreateAsDefault_Click(object sender, EventArgs e)
        {
            string      _tName = inputName.Text;
            int         _tMaxLP, _tCurrentLP, _tRecoverCycle;
            TimeSet     _TimeSet        = new TimeSet();
            LoadTimeSet _NewLoadTimeSet = new LoadTimeSet();

            _NewLoadTimeSet.tName = inputName.Text;
            _tMaxLP = (int)inputMaxLP.Value;
            _NewLoadTimeSet.tMaxLP        = (int)inputMaxLP.Value;
            _tCurrentLP                   = (int)inputCurrentLP.Value;
            _NewLoadTimeSet.tCurrrentLP   = (int)inputCurrentLP.Value;
            _tRecoverCycle                = (int)inputRecoverCycle.Value;
            _NewLoadTimeSet.tRecoverCycle = (int)inputRecoverCycle.Value;

            try
            {
                XmlSerializer          _serializer = new XmlSerializer(typeof(LoadTimeSet));
                System.IO.StreamWriter sw          = new System.IO.StreamWriter(inputName.Text + ".xml", false, new System.Text.UTF8Encoding(false));
                _serializer.Serialize(sw, _NewLoadTimeSet);
                sw.Close();

                ParentForm.SetTimer(_tName, _tMaxLP, _tCurrentLP, _tRecoverCycle, out _TimeSet.tName, out _TimeSet.tHour, out _TimeSet.tMinute, out _TimeSet.tSecond, out _TimeSet.tDate);
                ParentForm.CreatetForm(_TimeSet);

                this.Close();
            }catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Nortification", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        private void buttonCreateAsDefault_Click(object sender, EventArgs e)
        {
            string _tName = inputName.Text;
            int _tMaxLP, _tCurrentLP, _tRecoverCycle;
            TimeSet _TimeSet = new TimeSet();
            LoadTimeSet _NewLoadTimeSet = new LoadTimeSet();

            _NewLoadTimeSet.tName = inputName.Text;
            _tMaxLP = (int)inputMaxLP.Value;
            _NewLoadTimeSet.tMaxLP = (int)inputMaxLP.Value;
            _tCurrentLP = (int)inputCurrentLP.Value;
            _NewLoadTimeSet.tCurrrentLP = (int)inputCurrentLP.Value;
            _tRecoverCycle = (int)inputRecoverCycle.Value;
            _NewLoadTimeSet.tRecoverCycle = (int)inputRecoverCycle.Value;

            try
            {
                XmlSerializer _serializer = new XmlSerializer(typeof(LoadTimeSet));
                System.IO.StreamWriter sw = new System.IO.StreamWriter(inputName.Text + ".xml", false, new System.Text.UTF8Encoding(false));
                _serializer.Serialize(sw, _NewLoadTimeSet);
                sw.Close();

                ParentForm.SetTimer(_tName, _tMaxLP, _tCurrentLP, _tRecoverCycle, out _TimeSet.tName, out _TimeSet.tHour, out _TimeSet.tMinute, out _TimeSet.tSecond, out _TimeSet.tDate);
                ParentForm.CreatetForm(_TimeSet);

                this.Close();
                
            }catch(Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Nortification", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }