コード例 #1
0
ファイル: MainForm.cs プロジェクト: umartechboy/PhysLogger
        public void OnLoaded(object sender, EventArgs args)
        {
            Application.Idle -= new EventHandler(OnLoaded);
            // rest of your code
            // we need to work with resetting D3D FrameBuffer size, which couldn't be found in SlimDX.
            // Once this issue is resolved, we can use D3D.
            //completeLogControl.AttemptToAttachD3D();
            string f = "LastSession.plprj";

            if (!System.IO.File.Exists(f))
            {
                f = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "LastSession.plprj");
            }

            if (System.IO.File.Exists(f))
            {
                var data = System.IO.File.ReadAllLines(f);
                TimeSeriesCollection ts = null;
                try
                {
                    ts = TimeSeriesCollection.Deserialize(data);
                    completeLogControl.UpdateChannelVisuals(TimeSeriesCollection.Deserialize(data));
                }
                catch (Exception ex)
                {
                    MessageBox.Show("PhysLogger has met an unexpected error and must be restarted. \r\n\r\nAdditional Information: " + ex.ToString());
                    System.IO.File.Delete(f);
                    Close();
                }
            }

            completeLogControl.DontScrollPlotOnReSize = true;
            //completeLogControl.HW.AttachVirtualLogger1();
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: umartechboy/PhysLogger
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ofd.Filter = "PhysLogger Project Files (*.plprj)|*.plprj";
            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var data = System.IO.File.ReadAllLines(ofd.FileName);

            TimeSeriesCollection ts = null;

            try
            {
                completeLogControl.DataPort.Disconnect();
                ts = TimeSeriesCollection.Deserialize(data);
                try
                {
                    completeLogControl.dsCollectionForceSet = TimeSeriesCollection.Deserialize(data);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("PhysLogger has met an unexpected error. It will exit now. \r\n\r\nAdditional Information: " + ex.ToString());
                    Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("The selected file could not be parsed as a valid PhysLogger Project File.\r\n\r\nAdditional Information: " + ex.Message);
            }
        }