Esempio n. 1
0
 private void GroupByItem_Click(object sender, EventArgs e)
 {
     GroupByNoneMnu.Checked = GroupByHourMnu.Checked = GroupByDayMnu.Checked = GroupByWeekMnu.Checked = GroupByMonthMnu.Checked = false;
     ((ToolStripMenuItem)sender).Checked = true;
     if (sender == this.GroupByNoneMnu)
     {
         GroupBy = GXGroupBy.None;
     }
     else if (sender == this.GroupByHourMnu)
     {
         GroupBy = GXGroupBy.Hour;
     }
     else if (sender == this.GroupByDayMnu)
     {
         GroupBy = GXGroupBy.Day;
     }
     else if (sender == this.GroupByWeekMnu)
     {
         GroupBy = GXGroupBy.Week;
     }
     else if (sender == this.GroupByMonthMnu)
     {
         GroupBy = GXGroupBy.Month;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <remarks>
        /// Do not catch errors here.
        /// If error is occurred exception is shown and application is closed.
        /// </remarks>
        public MainForm()
        {
            InitializeComponent();
            CancelBtn.Enabled = false;
            GroupBy = GXGroupBy.None;
            Devices = new GXDLMSDeviceCollection();
            ObjectValueView.Visible = DeviceInfoView.Visible = DeviceList.Visible = false;
            ObjectValueView.Dock = ObjectPanelFrame.Dock = DeviceList.Dock = DeviceInfoView.Dock = DockStyle.Fill;
            ProgressBar.Visible = false;
            UpdateDeviceUI(null, DeviceState.None);
            Initialize();
            m_MruManager = new MRUManager(RecentFilesMnu);
            m_MruManager.OnOpenMRUFile += new OpenMRUFileEventHandler(this.OnOpenMRUFile);

            string path = Path.Combine(GXManufacturerCollection.ObisCodesPath, "GraphItems.xml");
            if (File.Exists(path))
            {
                try
                {
                    using (TextReader reader = new StreamReader(path))
                    {
                        XmlSerializer x = new XmlSerializer(typeof(GXObisCodeGraphItemCollection), new Type[] { typeof(GXObisCodeGraphItem) });
                        this.GraphItems = (GXObisCodeGraphItemCollection)x.Deserialize(reader);
                        reader.Close();
                    }
                }
                catch
                {
                    this.GraphItems.Clear();
                    //It's OK if this fails.
                }
            }
        }