Example #1
0
        private void ButtonOpen_Click(object sender, RoutedEventArgs e)
        {
            var item = sender as FrameworkElement;
            var dc   = item.DataContext;

            InstrumentControl.ShowInstrumentInfo(dc as IInstrument);
        }
        private void RadGridView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var dc = DataContext as AnalyseProjectViewModel;

            if (dc.CurrentResult != null && dc.CurrentResult.TargetObject != null)
            {
                InstrumentControl.ShowInstrumentInfo(dc.CurrentResult.TargetObject, () => { return(dc.CurrentDataSource); }, dc.AnalyseStartTime, dc.AnalyseEndTime);
            }
        }
        public static void ShowInstrumentInfo(IInstrument instrument)
        {
            var w  = new Window();
            var vm = new InstrumentViewModel()
            {
                TargetObject = instrument
            };
            var c = new InstrumentControl()
            {
                DataContext = vm
            };

            w.Content = c;
            w.Title   = instrument.Name;
            w.Show();
        }
        public static void ShowInstrumentInfo(IInstrument instrument, Func <IDataSource> ds, DateTime start, DateTime end)
        {
            var w  = new Window();
            var vm = new InstrumentViewModel()
            {
                TargetObject = instrument, StartTime = start, EndTime = end, GetCurrentDataSource = ds
            };
            var c = new InstrumentControl()
            {
                DataContext = vm
            };

            vm.LoadMarketData(start, end, ds, instrument);
            w.Content = c;
            w.Title   = instrument.Name;
            w.Show();
        }
        public static void ShowInstrumentInfo(string title, List <IMarketData> dataList)
        {
            var w  = new Window();
            var vm = new InstrumentViewModel()
            {
                IsEnableLoad = false, StartTime = dataList.Min(v => v.Time), EndTime = dataList.Max(v => v.Time)
            };

            dataList.ForEach(v => vm.MarketDataList.Add(v));
            var c = new InstrumentControl()
            {
                DataContext = vm
            };

            w.Content = c;
            w.Title   = title;

            w.Show();
        }