예제 #1
0
        public override bool Validate()
        {
            if (string.IsNullOrEmpty(ProfileName.Value))
            {
                var window = WindowAssist.GetWindow(Controller);
                MessageBoxEx.Show("A profile name is required to continue.", "Profile Name Required", parent: window);
                return(false);
            }

            var invalidChars = Path.GetInvalidFileNameChars();

            if (ProfileName.Value.Any(ch => invalidChars.Contains(ch)))
            {
                var window = WindowAssist.GetWindow(Controller);
                MessageBoxEx.Show($"The name of the profile cannot contain any of the following characters: {string.Join(",", invalidChars.Where(c => !char.IsControl(c)))}", "Invalid Name", parent: window);
                return(false);
            }

            if (!IsSingleDisplaySetup.Value && !IsSimPitSetup.Value && !IsVirtualRealitySetup.Value && !IsHeliosSetup.Value)
            {
                var window = WindowAssist.GetWindow(Controller);
                MessageBoxEx.Show("Please select a primary setup type by clicking on one of the images for either Single, Multiple Monitor or VR setup, to continue.", "Screen Setup", parent: window);
                return(false);
            }

            return(base.Validate());
        }
        private void OnDeleteViewport(ViewportModel value)
        {
            var window = WindowAssist.GetWindow(this);

            if (MessageBoxEx.Show($"Are you sure you want to delete viewport {value.Name.Value}?", "Delete Viewport", MessageBoxButton.YesNo, parent: window) == MessageBoxResult.Yes)
            {
                Viewports.Remove(value);
            }
        }
        public override bool Validate()
        {
            if (!Screens.Any(s => s.IsSelected.Value))
            {
                var window = WindowAssist.GetWindow(Controller);

                MessageBoxEx.Show("You must select at least 1 monitors for the UI Viewport.", "Select Monitor", parent: window);
                return(false);
            }

            return(base.Validate());
        }
예제 #4
0
        public override bool Validate()
        {
            if (Installations.Any() && Installations.Count(i => i.IsDefault.Value) == 0)
            {
                var window = WindowAssist.GetWindow(Controller);
                MessageBoxEx.Show("You must set a default installation to continue.", "Default Installations", MessageBoxButton.OK, parent: window);
                return(false);
            }

            if (Installations.Count(i => i.ConcreteInstall.IsValidInstall) == 0)
            {
                var window = WindowAssist.GetWindow(Controller);
                return(MessageBoxEx.Show("No valid DCS World installations were found.   Are you sure you want to continue?", "Installations", MessageBoxButton.YesNo, parent: window) == MessageBoxResult.Yes);
            }

            return(base.Validate());
        }
        private void OnAddViewport()
        {
            var window = WindowAssist.GetWindow(this);
            var dialog = new SelectViewportsDialog();
            var screen = Screen.AllScreens.First(d => d.DeviceName == MonitorId);

            foreach (var device in _devices)
            {
                if (ConsumedViewports.Any(v => v == device.ViewportName) ||
                    Viewports.Any(v => v.Name.Value == device.ViewportName))
                {
                    continue;
                }

                var model = new ViewportModel();

                model.Height.Value    = device.Height;
                model.InitFile.Value  = device.RelativeInitFilePath;
                model.ImageUrl.Value  = Path.Combine(ApplicationPaths.ViewportPath, "Images/{_module.ModuleId}/{device.ViewportName}.jpg");
                model.Name.Value      = device.ViewportName;
                model.Width.Value     = device.Width;
                model.SeatIndex.Value = device.SeatIndex;
                model.X.Value         = screen.Bounds.Width / 2 - device.Width / 2;
                model.Y.Value         = screen.Bounds.Height / 2 - device.Height / 2;

                dialog.Viewports.Add(model);
            }

            dialog.SelectedViewport = dialog.Viewports.First();
            dialog.Owner            = window;

            if (dialog.ShowDialog() ?? false)
            {
                var viewport = dialog.SelectedViewport;

                Viewports.Add(viewport);
            }
        }