Exemplo n.º 1
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;

            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);
        }
Exemplo 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.
                }
            }
        }