示例#1
0
文件: MainForm.cs 项目: khokm/QTS
        public MainForm()
        {
            InitializeComponent();

            ShowPreviousLines_ComboBox.SelectedIndex = 0;
            ShowGraphs_ComboBox.SelectedIndex        = 0;

            plot1.Model = new PlotModel()
            {
                IsLegendVisible = false,
            };

            controller = new QtsController(this, new OxyPlotFactory());

            /*
             * OxyPlot по умолчанию уже использует
             * клавиши стрелок для движения по диаграмме,
             * так что отцепим их
             */
            var keyBinder = new PlotController();

            keyBinder.UnbindKeyDown(OxyKey.Up);
            keyBinder.UnbindKeyDown(OxyKey.Down);
            keyBinder.UnbindKeyDown(OxyKey.Left);
            keyBinder.UnbindKeyDown(OxyKey.Right);

            plot1.Controller = keyBinder;

            System.Globalization.CultureInfo myCulture =
                (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            myCulture.NumberFormat.NaNSymbol = "Не определено";

            System.Threading.Thread.CurrentThread.CurrentCulture = myCulture;
        }
示例#2
0
        /// <summary>
        /// グラフのマウス操作、キー操作を初期化します。
        /// </summary>
        /// <param name="gestureController">マウス操作のバインド。</param>
        public static void InitializeBind(this PlotController gestureController)
        {
            // グラフのマウス操作およびキー操作の初期化
            gestureController.UnbindKeyDown(OxyKey.A);
            gestureController.UnbindKeyDown(OxyKey.C, OxyModifierKeys.Control);
            gestureController.UnbindKeyDown(OxyKey.C, OxyModifierKeys.Control | OxyModifierKeys.Alt);
            gestureController.UnbindKeyDown(OxyKey.R, OxyModifierKeys.Control | OxyModifierKeys.Alt);
            gestureController.UnbindTouchDown();
            gestureController.UnbindMouseDown(OxyMouseButton.Left);
            gestureController.UnbindMouseDown(OxyMouseButton.Middle);
            gestureController.UnbindMouseDown(OxyMouseButton.Right);

            gestureController.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt);
            gestureController.BindMouseDown(OxyMouseButton.Middle, PlotCommands.PointsOnlyTrack);
            gestureController.BindMouseDown(OxyMouseButton.Right, PlotCommands.ZoomRectangle);
        }
示例#3
0
        public MainWindow() : base(Gtk.WindowType.Toplevel)
        {
            Build();

            DateStartEntry.Text   = Fetcher.StartAt.ToString(DateStringFormat);
            DateStartEntry.Xalign = 0.5F;
            DateEndEntry.Text     = Fetcher.EndAt.ToString(DateStringFormat);
            DateEndEntry.Xalign   = 0.5F;

            foreach (Currencies currency in Enum.GetValues(typeof(Currencies)))
            {
                CurrencyBaseSelection.AppendText(currency.ToString() + " - " + currency.GetStringValue());
            }
            CurrencyBaseSelection.Active = (int)Fetcher.Base;

            MainPlotController.UnbindKeyDown(OxyKey.A);
            MainPlotController.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt);
            MainPlotController.BindMouseDown(OxyMouseButton.Right, PlotCommands.PointsOnlyTrack);
            MainPlotController.BindKeyDown(OxyKey.Add, PlotCommands.ZoomInFine);
            MainPlotController.BindKeyDown(OxyKey.Subtract, PlotCommands.ZoomOutFine);
            MainPlotController.BindKeyDown(OxyKey.Up, PlotCommands.PanDownFine);
            MainPlotController.BindKeyDown(OxyKey.W, PlotCommands.PanDown);
            MainPlotController.BindKeyDown(OxyKey.Down, PlotCommands.PanUpFine);
            MainPlotController.BindKeyDown(OxyKey.S, PlotCommands.PanUp);
            MainPlotController.BindKeyDown(OxyKey.Left, PlotCommands.PanRightFine);
            MainPlotController.BindKeyDown(OxyKey.A, PlotCommands.PanRight);
            MainPlotController.BindKeyDown(OxyKey.Right, PlotCommands.PanLeftFine);
            MainPlotController.BindKeyDown(OxyKey.D, PlotCommands.PanLeft);

            MainPlotModel = new PlotModel();
            MainPlotModel.Axes.Add(new DateTimeAxis
            {
                Position           = AxisPosition.Bottom,
                IntervalType       = DateTimeIntervalType.Days,
                StringFormat       = "dd-MM\nyyyy",
                MajorGridlineStyle = LineStyle.Solid,
                MinimumMajorStep   = 1
            });
            MainPlotModel.Axes.Add(new LinearAxis
            {
                Position           = AxisPosition.Left,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                TickStyle          = TickStyle.Outside
            });

            MainPlotView = new PlotView {
                Model = MainPlotModel, Controller = MainPlotController
            };
            MainPlotAlignment.Add(MainPlotView);
            MainPlotView.Show();

            ChangeStatus(ReadyStatusText);
        }