Beispiel #1
0
        public SettingsWindow(IStreamLinesPlotWindow _w)
        {
            tmpGeom   = Settings.PlotGeomParams.Clone();
            tmpVisual = Settings.PlotVisualParams.Clone();
            //Hide close button
            Loaded += (sender, e) =>
            {
                var hwnd = new WindowInteropHelper(this).Handle;
                SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
            };
            InitializeComponent();
            Deactivated += (sender, e) => { Close(); };
            FillRectangle();
            w = _w;
            targetList.SelectionChanged          += TargetList_SelectionChanged;
            targetList.SelectedIndex              = 0;
            ThicknessSlider.ValueChanged         += ThicknessSlider_ValueChanged;
            targetThicknessList.SelectionChanged += TargetThicknessList_SelectionChanged;
            targetThicknessList.SelectedIndex     = 0;

            hVertSlider.Value = Settings.PlotGeomParams.hVertical; hVertSlider.ValueChanged += PlotParamsSlider_ValueChanged;
            hHorSlider.Value  = Settings.PlotGeomParams.MRKh; hHorSlider.ValueChanged += PlotParamsSlider_ValueChanged;
            xMaxSlider.Value  = Settings.PlotGeomParams.XMax; xMaxSlider.ValueChanged += PlotParamsSlider_ValueChanged;
            xMinSlider.Value  = Settings.PlotGeomParams.XMin; xMinSlider.ValueChanged += PlotParamsSlider_ValueChanged;

            if (w is HalfPlane)
            {
                yMinSlider.Value = yMinSlider.Maximum = 0; yMinSlider.IsEnabled = false;
                yMaxSlider.Value = Settings.PlotGeomParams.YMax; yMaxSlider.ValueChanged += PlotParamsSlider_ValueChanged;
            }
            else if (w is ZoneWindow)
            {
                yMinSlider.Value = yMinSlider.Maximum = -Math.PI; yMinSlider.IsEnabled = false;
                yMaxSlider.Value = yMaxSlider.Minimum = Math.PI; yMaxSlider.IsEnabled = false;
            }
            else
            {
                yMinSlider.Value = Settings.PlotGeomParams.YMin; yMinSlider.ValueChanged += PlotParamsSlider_ValueChanged;
                yMaxSlider.Value = Settings.PlotGeomParams.YMax; yMaxSlider.ValueChanged += PlotParamsSlider_ValueChanged;
            }

            hVertOutputTextBlock.Text = hVertSlider.Value.ToString(Settings.Format);
            hHorOutputTextBlock.Text  = hHorSlider.Value.ToString(Settings.Format);
            xMaxOutputTextBlock.Text  = xMaxSlider.Value.ToString(Settings.Format);
            xMinOutputTextBlock.Text  = xMinSlider.Value.ToString(Settings.Format);
            yMaxOutputTextBlock.Text  = yMaxSlider.Value.ToString(Settings.Format);
            yMinOutputTextBlock.Text  = yMinSlider.Value.ToString(Settings.Format);
        }
        static Settings()
        {
            exitIcoSource         = new BitmapImage(new Uri(@"Resources/exitIco.bmp", UriKind.Relative));
            exitIcoSelectedSource = new BitmapImage(new Uri(@"Resources/exitSelected.bmp", UriKind.Relative));
            saveIcoSource         = new BitmapImage(new Uri(@"Resources/saveIco3.png", UriKind.Relative));
            saveIcoSelectedSource = new BitmapImage(new Uri(@"Resources/saveIco3Selected.png", UriKind.Relative));
            OKIcoSource           = new BitmapImage(new Uri(@"Resources/okayIcon.png", UriKind.Relative));

            StartIcoSource = new BitmapImage(new Uri(@"Resources/StartButtonIco.ico", UriKind.Relative));
            ClockIcoSource = new BitmapImage(new Uri(@"Resources/clockIco.gif", UriKind.Relative));

            HalfPlaneImageSource = new BitmapImage(new Uri(@"Resources/HalfPlaneImage.png", UriKind.Relative));
            ZoneImageSource      = new BitmapImage(new Uri(@"Resources/ZoneImage.png", UriKind.Relative));
            CircleImageSource    = new BitmapImage(new Uri(@"Resources/CircleImage.png", UriKind.Relative));
            HeatMapImageSource   = new BitmapImage(new Uri(@"Resources/heatMapImage.png", UriKind.Relative));
            EmptyImageSource     = new BitmapImage(new Uri(@"Resources/Empty.png", UriKind.Relative));

            MMFImageSource = new BitmapImage(new Uri(@"Resources/mmfImage.png", UriKind.Relative));

            PlotGeomParams = new StreamLinesPlotGeomParams()
            {
                hVertical = 0.5, MRKh = 0.3, XMax = 20, XMin = -20, YMax = 20, YMin = -20
            };
            PlotVisualParams = new StreamLinesPlotVisualParams()
            {
                LineColor             = OxyColors.Blue,
                ArrowColor            = OxyColors.Black,
                BorderFillColor       = OxyColors.Gray,
                BorderStrokeColor     = OxyColors.Black,
                BorderStrokeThickness = 1,
                LineStrokeThickness   = 3,
                ArrowStokeThickness   = 3
            };
            PlotGeomParamsConstant   = PlotGeomParams.Clone();
            PlotVisualParamsConstant = PlotVisualParams.Clone();
        }