示例#1
0
        private void Open_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            StateKeeper.IsMenuOpened       = false;
            StateKeeper.FolderContentIsOld = true;

            // From UnFilemanager.dll
            OpenManager manager = new OpenManager(new OpenDialogWrapper(),
                                                  UnFMFilters.SupportedExtentions,   // From UnFilemanager.dll
                                                  App.SupportExtentions);

            var(dialogresult, filePath, filePaths) = manager.GetDialogData(new MistakeMessanger());

            if (dialogresult)
            {
                FilePath = filePath;
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.UnhandledException += ExceptionHandler;
            _graphSettings   = new GraphSettings();
            _collectSettings = new CollectSettings();
            DataContext      = this;
            _keyHooker.SetHook();
            _keyHooker.OnHook   += OnHook;
            m_SaveManager        = new SaveManager();
            m_OpenManager        = new OpenManager();
            _graphfileextensions = new Dictionary <string, Saver> {
                { "graphics files (*.grph)|*.grph", new BinSaver() }
            };


            var serializer = new XmlSerializer(typeof(List <string>));

            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "Filters.xml"))
            {
                using (var filestream = new FileStream("Filters.xml", FileMode.Open))
                {
                    _collectSettings.FilterList = (List <string>)serializer.Deserialize(filestream);
                }
            }
            else
            {
                _collectSettings.FilterList = new List <string>();
            }

            var zedGraph = (ZedGraphControl)WinHost.Child;

            zedGraph.GraphPane.CurveList.Clear();
            GraphPane pane = zedGraph.GraphPane;

            pane.Title.Text       = "";
            pane.XAxis.Title.Text = "";
            pane.YAxis.Title.Text = "";

            dg_Data.EnableColumnVirtualization = true;
            dg_Data.EnableRowVirtualization    = true;
            Ordinats                = new ObservableCollection <CheckedListItem <string> >();
            TableColumns            = new ObservableCollection <CheckedListItem <string> >();
            lb_Measures.ItemsSource = Ordinats;
            lb_Columns.ItemsSource  = TableColumns;

            _recorders = new[]
            {
                new FlightDataRecorder("http://127.0.0.1:8111/state", true, _collectSettings.FailureDelay),
                new FlightDataRecorder("http://127.0.0.1:8111/indicators", false, _collectSettings.FailureDelay)
            };
            m_Manager = new FdrManager(_recorders, _collectSettings.RequestInterval);

            m_DataProcessingHelper = new DataProcessingHelper(m_Manager);
            m_DataProcessingHelper.GraphControl    = (ZedGraphControl)WinHost.Child;
            m_DataProcessingHelper.DataGrid        = dg_Data;
            m_DataProcessingHelper.CollectSettings = _collectSettings;
            m_DataProcessingHelper.GraphSettings   = _graphSettings;

            m_Manager.OnStartDataCollecting += OnStartNewDataCollecting;
            m_Manager.OnDataCollected       += OnDataCollected;
            m_Manager.OnTotalFailure        += OnFailure;
            m_Manager.OnRecorderFailure     += OnRecorderFailure;

            m_CompareHelper = new CompareHelper()
            {
                GraphControl  = (ZedGraphControl)wh_Compare.Child,
                GraphSettings = _graphSettings,
                LbSources     = lb_Compare_Sources,
                LbOdinates    = lb_Compare_Measures,
                CbAbscissa    = cb_Compare_Abscissa
            };
        }