Exemplo n.º 1
0
        void SynchronizeGraphicsDeviceManager(ScreenMode targetMode)
        {
            gameForm.LocationChanged -= GameForm_LocationChanged;
            switch (targetMode)
            {
            case ScreenMode.WindowedPresetResolution:
                if (GraphicsDeviceManager.IsFullScreen)
                {
                    GraphicsDeviceManager.ToggleFullScreen();
                }
                if (targetMode != currentScreenMode)
                {
                    gameForm.Location = gameWindowOrigin;
                }
                gameForm.FormBorderStyle = FormBorderStyle.FixedSingle;
                GraphicsDeviceManager.PreferredBackBufferWidth  = gameWindowSize.Width;
                GraphicsDeviceManager.PreferredBackBufferHeight = gameWindowSize.Height;
                GraphicsDeviceManager.ApplyChanges();
                break;

            case ScreenMode.FullscreenPresetResolution:
                gameForm.FormBorderStyle = FormBorderStyle.FixedSingle;
                GraphicsDeviceManager.PreferredBackBufferWidth  = gameWindowSize.Width;
                GraphicsDeviceManager.PreferredBackBufferHeight = gameWindowSize.Height;
                GraphicsDeviceManager.ApplyChanges();
                if (!GraphicsDeviceManager.IsFullScreen)
                {
                    GraphicsDeviceManager.ToggleFullScreen();
                }
                break;

            case ScreenMode.FullscreenNativeResolution:
                if (GraphicsDeviceManager.IsFullScreen)
                {
                    GraphicsDeviceManager.ToggleFullScreen();
                }
                GraphicsDeviceManager.PreferredBackBufferWidth  = currentScreen.Bounds.Width;
                GraphicsDeviceManager.PreferredBackBufferHeight = currentScreen.Bounds.Height;
                GraphicsDeviceManager.ApplyChanges();
                gameForm.FormBorderStyle = game.Settings.FastFullScreenAltTab ? FormBorderStyle.None : FormBorderStyle.FixedSingle;
                if (targetMode != currentScreenMode)
                {
                    gameWindowOrigin = gameForm.Location;
                }
                gameForm.Location = currentScreen.Bounds.Location;
                GraphicsDeviceManager.ApplyChanges();
                if (!game.Settings.FastFullScreenAltTab)
                {
                    GraphicsDeviceManager.ToggleFullScreen();
                }
                break;
            }
            currentScreenMode         = targetMode;
            gameForm.LocationChanged += GameForm_LocationChanged;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Closing the screen.
 /// </summary>
 /// <param name="i_GameTime"></param>
 private void done(GameTime i_GameTime)
 {
     if (ScreenMode.HasFlag(eScreenMode.Running))
     {
         if (m_menuCollection.Selected == 3)
         {
             playSound();
             Close();
         }
     }
 }
Exemplo n.º 3
0
        public static void Navigate(GameContext context, ScreenMode screenMode, string field, object data)
        {
            var screenData = GetScreenData(context);

            // https://stackoverflow.com/questions/139592/what-is-the-best-way-to-clone-deep-copy-a-net-generic-dictionarystring-t
            var newScreenData = new Dictionary <string, object>(screenData);

            newScreenData[field] = data;

            Navigate(context, screenMode, newScreenData);
        }
Exemplo n.º 4
0
 protected void SwitchToFullscreen(int screenNum)
 {
     System.Windows.Forms.Screen[] screens = System.Windows.Forms.Screen.AllScreens;
     System.Windows.Forms.Screen   screen  = screenNum < 0 || screenNum >= screens.Length ?
                                             System.Windows.Forms.Screen.PrimaryScreen :
                                             System.Windows.Forms.Screen.AllScreens[screenNum];
     WindowState     = FormWindowState.Normal;
     FormBorderStyle = FormBorderStyle.None;
     _mode           = ScreenMode.FullScreen;
     SetScreenSize(screen);
 }
Exemplo n.º 5
0
 protected void SwitchToWindowedSize(Point location, Size clientSize, bool maximize)
 {
     WindowState     = FormWindowState.Normal;
     FormBorderStyle = FormBorderStyle.Sizable;
     Location        = location;
     ClientSize      = clientSize;
     // We must restore the window state after having set the ClientSize/Location to make the window remember the
     // non-maximized bounds
     WindowState = maximize ? FormWindowState.Maximized : FormWindowState.Normal;
     _mode       = ScreenMode.NormalWindowed;
 }
Exemplo n.º 6
0
 public static void SaveWithChanges(int w, int h, ScreenMode screenMode)
 {
     StreamWriter writer = new StreamWriter(ScreenPath);
     writer.WriteLine(Names[0] + '=' + w.ToString());
     writer.WriteLine(Names[1] + '=' + h.ToString());
     writer.WriteLine(Names[6] + '=' + screenMode.ToString());
     writer.WriteLine(Names[2] + '=' + Screen.BorderLow.ToString());
     writer.WriteLine(Names[3] + '=' + Screen.BorderHigh.ToString());
     writer.WriteLine(Names[5] + "=0,03");
     writer.WriteLine(Names[4] + "=10");
     writer.Close();
 }
Exemplo n.º 7
0
 public MaintainCustomersEmployees(ScreenMode screenmode, LawnProMainWindow owner, Customer passedcustomer)
 {
     InitializeComponent();
     screenMode = screenmode;
     _owner     = owner;
     LoadScreen();
     MoveButtons(btnUpdate, 0);
     FillTextBoxes(passedcustomer);
     customerId       = passedcustomer.Id;
     lblTitle.Content = screenMode.ToString();
     this.Title       = "Maintain " + screenMode.ToString();
 }
Exemplo n.º 8
0
        public MaintainCustomersEmployees(ScreenMode screenmode, LawnProMainWindow owner)
        {
            InitializeComponent();
            screenMode = screenmode;
            _owner     = owner;
            MoveButtons(btnAdd, 0);
            LoadScreen();
            txtFirstName.Focus();

            lblTitle.Content = screenMode.ToString();
            this.Title       = "Maintain " + screenMode.ToString();
        }
Exemplo n.º 9
0
        public static void UpdateHistory(GameContext context, ScreenMode screenMode, Dictionary <string, object> data)
        {
            var history = GetNavigationHistory(context);

            var q = history.navigationHistory.Queries;

            q.Add(new MenuComponent {
                Data = data, ScreenMode = screenMode
            });

            history.ReplaceNavigationHistory(q);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 设置应用更新、确定、取消的按钮事件
        /// </summary>
        void SetOtherListener()
        {
            var updateBtn    = transform.Find("Version/UpdateBtn").GetComponent <Button>();
            var okBtn        = transform.Find("OKBtn").GetComponent <Button>();
            var cancelBtn    = transform.Find("CancelBtn").GetComponent <Button>();
            var openFieldBtn = transform.Find("RecordPath/OpenFieldBtn").GetComponent <Button>();

            updateBtn.onClick.AddListener(delegate
            {
            });

            okBtn.onClick.AddListener(delegate
            {
                lastIsNoneProjection  = isNoneProjection;
                lastScreenDimensional = screenDimensional;
                lastScreenmode        = screenmode;
                var curMode           = GetScreenMode();

                curScreenmode = curMode;

                ScreenManger.Instance.SetScreenMode(curMode);


                CloseSettingUI();
            });

            cancelBtn.onClick.AddListener(delegate
            {
                isNoneProjection  = lastIsNoneProjection;
                screenDimensional = lastScreenDimensional;
                screenmode        = lastScreenmode;

                SetScreenMode();
                SetAllToggleState();
                CloseSettingUI();
            });

            openFieldBtn.onClick.AddListener(delegate
            {
                if (recordOperate == null)
                {
                    recordOperate = FindObjectOfType <RecordOperate>();
                }
                if (!recordOperate.startFlag)
                {
                    SetSavePath();
                }
                else
                {
                    OperateWarnning.Instance.ShowWarnningPanel("正在执行录屏中,请等录屏结束后再去修改录屏保存的位置。谢谢!");
                }
            });
        }
Exemplo n.º 11
0
 private void StartWalkScreen()
 {
     RemoveOldScreen();
     if (_walkScreen == null)
     {
         _walkScreen = new WalkScreen();
     }
     _walkScreen.StartDisplay(StopLastScreenAndGetLastTravel());
     _currentScreen = ScreenMode.Walk;
     Grid.SetRow(_walkScreen, 1);
     GridX.Children.Add(_walkScreen);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Toggle players amount Enum.
 /// </summary>
 /// <param name="i__GameTime"></param>
 private void togglePlayersAmount(GameTime i__GameTime)
 {
     if (ScreenMode.HasFlag(eScreenMode.Running))
     {
         if (m_menuCollection.Selected == 1)
         {
             ScreensManager.GameSettings.PlayersAmount = 3 - ScreensManager.GameSettings.PlayersAmount;
             m_menuCollection.GetMenuLabelAt(1).ChangeText(string.Format("Players: {0}", ScreensManager.GameSettings.PlayersAmount.ToString()));
             playSound();
         }
     }
 }
Exemplo n.º 13
0
        public Resolution(GraphicsDeviceManager graphics, ScreenMode virtualMode, ScreenMode mode)
        {
            this.Mode = mode;
              this.baseMode = virtualMode;

              viewport.X = 0;
              viewport.Y = 0;
              viewport.Width = screenWidth;
              viewport.Height = screenHeight;

              SetResolution(graphics);
        }
Exemplo n.º 14
0
        public void SwitchMode(ScreenMode mode)
        {
            if (InvokeRequired)
            {
                Invoke(new SwitchModeDelegate(SwitchMode), mode);
                return;
            }

            ServiceRegistration.Get <ILogger>().Debug("SkinEngine MainForm: Switching mode to {0}", mode);
            bool        newFullscreen = mode == ScreenMode.FullScreen;
            AppSettings settings      = ServiceRegistration.Get <ISettingsManager>().Load <AppSettings>();

            // Already done, no need to do it twice
            if (mode == _mode)
            {
                return;
            }

            int screenNum = GetScreenNum();

            settings.FSScreenNum = screenNum;
            settings.FullScreen  = newFullscreen;
            ServiceRegistration.Get <ISettingsManager>().Save(settings);

            StopUI();

            _adaptToSizeEnabled = false;
            try
            {
                // Must be done before reset. Otherwise we will lose the device after reset.
                if (newFullscreen)
                {
                    StoreClientBounds();
                    SwitchToFullscreen(screenNum);
                }
                else
                {
                    SwitchToWindowedSize(_previousWindowLocation, _previousWindowClientSize, _previousWindowState == FormWindowState.Maximized);
                }
            }
            finally
            {
                _adaptToSizeEnabled = true;
            }
            SkinContext.WindowSize = ClientSize;

            Update();
            Activate();
            CheckTopMost();

            StartUI();
        }
Exemplo n.º 15
0
 private void screenMode_SelectedValueChanged(object sender, EventArgs e)
 {
     currentMode = (ScreenMode)screenMode.SelectedItem;
     if (currentMode == ScreenMode.Average)
     {
         x            = (int)Mathf.Clamp(x, 50, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width - 50);
         y            = (int)Mathf.Clamp(y, 50, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height - 50);
         previewX     = x;
         previewY     = y;
         screenX.Text = x.ToString();
         screenY.Text = y.ToString();
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// Создает вкладку с информацией о рабочей карте
        /// </summary>
        /// <param name="maintenanceSubCheck"></param>
        /// <param name="dialogFileName"></param>
        public JobCardTabPageControl(MaintenanceSubCheck maintenanceSubCheck, string dialogFileName)
        {
            parentMaintenanceSubCheck            = maintenanceSubCheck;
            currentJobCard                       = new JobCard();
            currentJobCard.Date                  = DateTime.Today;
            currentJobCard.AttachedFile.FileData = UsefulMethods.GetByteArrayFromFile(dialogFileName);
            string cardNumber = dialogFileName.Substring(dialogFileName.LastIndexOf('\\') + 1);

            textBoxJobCard.Text = cardNumber.Substring(0, cardNumber.LastIndexOf('.'));
            mode = ScreenMode.Add;
            InitializeComponent();
            UpdateInformation();
        }
Exemplo n.º 17
0
 public RPT002_WorkPlaceAirQualityEntry(int ID, bool isCopy = false)
 {
     InitializeComponent();
     wpaResult = vmRpt.GetWorkPlaceAir(ID);
     if (isCopy)
     {
         mode = ScreenMode.Add;
     }
     else
     {
         mode = ScreenMode.Edit;
     }
 }
Exemplo n.º 18
0
 private void lb_screenMode_Click(object sender, EventArgs e)
 {
     if (scMode == ScreenMode.FULLSCREEN)
     {
         scMode             = ScreenMode.WINDOWED;
         lb_screenMode.Text = "Windowed";
     }
     else if (scMode == ScreenMode.WINDOWED)
     {
         scMode             = ScreenMode.FULLSCREEN;
         lb_screenMode.Text = "Fullscreen";
     }
 }
 public RPT001_WorkPlaceLightIntensityEntry(int ID, bool isCopy = false)
 {
     InitializeComponent();
     wplResult = vmRpt.GetWorkPlaceLight(ID);
     if (isCopy)
     {
         mode = ScreenMode.Add;
     }
     else
     {
         mode = ScreenMode.Edit;
     }
 }
Exemplo n.º 20
0
 private void StartSplashScreen()
 {
     RemoveOldScreen();
     if (_sscreen == null)
     {
         _sscreen = new StateViews.SplashScreen();
     }
     _sscreen.StartDisplay(StopLastScreenAndGetLastTravel());
     _currentScreen = ScreenMode.Splash;
     _sscreen.StartNewOfferTimer(Properties.Settings.Default.PictureChangeIntervallMS);
     Grid.SetRow(_sscreen, 1);
     GridX.Children.Add(_sscreen);
 }
Exemplo n.º 21
0
        public BasicScreen(IUI ui, ScreenMode mode, int colorswitch = 0, int activePage = 0, int visualPage = 0)
        {
            _ui           = ui;
            Mode          = mode;
            _colorEnabled = colorswitch > 0;

            AllScreenPages = new List <IScreenPage>();

            ConfigureScreen();

            SetActivePage(activePage);
            SetVisualPage(visualPage);
        }
Exemplo n.º 22
0
 internal static void SwitchScreen(Form target, ScreenMode mode)
 {
     switch(mode) {
     case ScreenMode.Fullscreen:
       target.WindowState = FormWindowState.Normal;
       target.FormBorderStyle = FormBorderStyle.None;
       target.WindowState = FormWindowState.Maximized;
       break;
     case ScreenMode.Normal:
       target.FormBorderStyle = FormBorderStyle.Sizable;
       target.WindowState = FormWindowState.Normal;
       break;
       }
 }
Exemplo n.º 23
0
        /// <summary>
        /// Создает вкладку с информацией о рабочей карте
        /// </summary>
        /// <param name="jobCard"></param>
        public JobCardTabPageControl(JobCard jobCard)
        {
            currentJobCard = jobCard;
            mode           = ScreenMode.Edit;
            InitializeComponent();

            permissionForUpdate        = currentJobCard.HasPermission(Users.CurrentUser, DataEvent.Update);
            textBoxJobCard.ReadOnly    = !permissionForUpdate;
            textBoxWorkArea.ReadOnly   = !permissionForUpdate;
            textBoxRevision.ReadOnly   = !permissionForUpdate;
            dateTimePickerDate.Enabled = permissionForUpdate;
            textBoxRemarks.ReadOnly    = !permissionForUpdate;
            UpdateInformation();
        }
Exemplo n.º 24
0
        /// <summary>
        /// Данные работы обновляются по введенным значениям
        /// </summary>
        private bool SaveData()
        {
            int startPageNo;

            if (!CheckStartPageNo(out startPageNo))
            {
                return(false);
            }
            if (currentATLB.ATLBNo != textBoxATLBNo.Text)
            {
                currentATLB.ATLBNo = textBoxATLBNo.Text;
            }
            if (currentATLB.Revision != textBoxRevision.Text)
            {
                currentATLB.Revision = textBoxRevision.Text;
            }
            if (currentATLB.StartPageNo != startPageNo)
            {
                currentATLB.StartPageNo = startPageNo;
            }
            if (currentATLB.Remarks != textBoxRemarks.Text)
            {
                currentATLB.Remarks = textBoxRemarks.Text;
            }
            if (currentATLB.AttachedFile != fileControl.AttachedFile)
            {
                currentATLB.AttachedFile.FileName = fileControl.AttachedFile.FileName;
                currentATLB.AttachedFile.FileData = fileControl.AttachedFile.FileData;
            }
            try
            {
                if (mode == ScreenMode.Add)
                {
                    parentAircraft.RegisterATLB(currentATLB);
                    if (fileControl.AttachedFile != null)
                    {
                        currentATLB.AttachedFile.FileName = fileControl.AttachedFile.FileName;
                        currentATLB.AttachedFile.FileData = fileControl.AttachedFile.FileData;
                    }
                    mode = ScreenMode.Edit;
                }
                currentATLB.Save(true);
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
            }

            return(true);
        }
        public static void SetScreenModeCommand(string[] args)
        {
            if (int.TryParse(args[0], out int screenModeIndex))
            {
                ScreenMode screenMode = (ScreenMode)screenModeIndex;

                GameSettings.VideoSettings.ScreenMode = screenMode;
                GameSettings.Save();

                return;
            }

            Logger.Error("Invalid input!");
        }
Exemplo n.º 26
0
        protected void SwitchToFullscreen(int screenNum)
        {
            System.Windows.Forms.Screen[] screens = System.Windows.Forms.Screen.AllScreens;
            System.Windows.Forms.Screen   screen  = screenNum < 0 || screenNum >= screens.Length ?
                                                    System.Windows.Forms.Screen.PrimaryScreen :
                                                    System.Windows.Forms.Screen.AllScreens[screenNum];
            WindowState = FormWindowState.Normal;
            Rectangle rect = screen.Bounds;

            Location        = rect.Location;
            ClientSize      = rect.Size;
            FormBorderStyle = FormBorderStyle.None;
            _mode           = ScreenMode.FullScreen;
        }
Exemplo n.º 27
0
        private void SetScreenMode(ScreenMode screenMode)
        {
            CurrentScreenMode = screenMode;

            previousModeBits = modeBits.ToArray();

            currentColumnsCount      = screenMode == ScreenMode.Text1 ? 40 : screenMode == ScreenMode.Text2 ? 80 : 32;
            currentlyIn80ColumnsMode = (screenMode == ScreenMode.Text2);
            colorTableLength         = screenMode == ScreenMode.Text2 ? 270 : 32;
            displayRenderer.SetScreenMode(screenMode);

            UpdateNumberOfRows();

            ScreenModeChanged?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 28
0
        public static ScreenMode GetPreferredMode(GraphicsDeviceManager graphics)
        {
            DisplayMode displayMode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
            ScreenMode  mode        = ScreenMode.XGA;

            if (displayMode.Width == 1920 && displayMode.Height == 1080)
            {
                mode = ScreenMode.tv1080p;
            }
            else if (displayMode.Width == 1280 && displayMode.Height == 720)
            {
                mode = ScreenMode.tv720p;
            }
            return(mode);
        }
Exemplo n.º 29
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            ScreenMode mode = ScreenMode.View;

            if (permissionForUpdate)
            {
                mode = ScreenMode.Edit;
            }
            EngineeringOrderDirectiveTaskForm form = new EngineeringOrderDirectiveTaskForm(SelectedItem, mode);

            if (form.ShowDialog() == DialogResult.OK)
            {
                UpdateInformation();
            }
        }
        void GameStart(bool newGame, ref bool autoSaved, ref bool gameActive)
        {
            if (newGame == true)
            {
                _playfield.Reset();
            }
            _mainTitleMusic.Stop();
            _musicStarted  = false;
            _updatedScores = false;

            autoSaved  = false;
            Active     = false;
            gameActive = true;
            Mode       = ScreenMode.Gameover;
        }
Exemplo n.º 31
0
 private void ButtonEdit_DisplayerRequested(object sender, ReferenceEventArgs e)
 {
     if (mode == ScreenMode.Edit)
     {
         e.Cancel = true;
     }
     if (SaveData())
     {
         mode = ScreenMode.Edit;
     }
     else
     {
         e.Cancel = true;
     }
 }
Exemplo n.º 32
0
        internal static void SwitchScreen(Form target, ScreenMode mode)
        {
            switch (mode)
            {
            case ScreenMode.Fullscreen:
                target.WindowState     = FormWindowState.Normal;
                target.FormBorderStyle = FormBorderStyle.None;
                target.WindowState     = FormWindowState.Maximized;
                break;

            case ScreenMode.Normal:
                target.FormBorderStyle = FormBorderStyle.Sizable;
                target.WindowState     = FormWindowState.Normal;
                break;
            }
        }
Exemplo n.º 33
0
        public MaintainCustomersEmployees(ScreenMode screenmode, LawnProMainWindow owner, Employee employee, bool magnify)
        {
            InitializeComponent();
            screenMode           = screenmode;
            _owner               = owner;
            btnAdd.Visibility    = Visibility.Hidden;
            btnUpdate.Visibility = Visibility.Hidden;
            LoadScreen();
            FillTextBoxes(employee);
            JustMagnify();

            employeeId = employee.Id;

            lblTitle.Content = screenMode.ToString();
            this.Title       = "Inspect " + screenMode.ToString();
        }
Exemplo n.º 34
0
        public static void Initialize(int width, int height, ScreenMode screenType, double persentRad, int borderLow, int borderHigh, int step)
        {
            ScreenType = screenType;
            ResolutionH = height;
            ResolutionW = width;
            Width = width;
            Height = height;
            if (ScreenType == ScreenMode.windowed)
            {
                Width -= 2 * borderLow;
                Height -= borderLow + borderHigh;
            }
            BorderLow = borderLow;
            BorderHigh = borderHigh;

            WorkSpace.Initialize(persentRad, step);
        }
Exemplo n.º 35
0
        public static void ChangeMode(ScreenMode m)
        {
            Clear();

            /*if (m == Chip8)
            {
                Globals.RES_X = 64;
                Globals.RES_Y = 32;
                screenArray = new int[Globals.RES_X, Globals.RES_Y];
            }
            else if (m == SChip)
            {
                Globals.RES_X = 128;
                Globals.RES_Y = 64;
                screenArray = new int[Globals.RES_X, Globals.RES_Y];
            }*/

            Mode = m;
        }
Exemplo n.º 36
0
        public Game1(ScreenMode sm, bool fs)
        {
            Window.Title = "S.H.M.U.P";
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            tmgr = new ThreadManager(this);
            tmgr.AddThread(new ThreadCode(Thread1), 50);
            tmgr.AddThread(new ThreadCode(Thread2), 10);
            tmgr.AddThread(new ThreadCode(Thread3), 50);
            Components.Add(tmgr);

            scrmgr = new ScreenManager(sm, fs);
            scrmgr.loadScreen = new Screens.LoadingScreen();
            scrmgr.currentScreen = new Screens.SplashScreen();

            inpmgr = new InputManager();

            sndmgr = new SoundManager();

            content = Content;
            musman = new MusicManager();

            bloom = new BloomComponent(this);
            Components.Add(bloom);

            Strings.Culture = CultureInfo.CurrentCulture;
            /*icc= new IndieCityComponent(
                "fbdb6004-47c5-4613-882c-c8c4a4ee6716",   // replace with your Game ID
                "80514114-4048-4382-b34d-468252fcacee",   // replace with your ICELib ID
                "303d3914-86e1-43bd-9f63-100eb9dbf282", // replace with your ICELib Secret
                true,   // replace with false if your game has no achievements
                false,   // replace with false if your game has no leaderboards
                this);
            Components.Add(icc);*/
        }
Exemplo n.º 37
0
 protected void SwitchToWindowedSize(ScreenMode mode, Point location, Size clientSize, bool maximize)
 {
   if (mode == ScreenMode.WindowedOnTop)
   {
     _forceOnTop = true;
     FormBorderStyle = FormBorderStyle.SizableToolWindow;
   }
   else
   {
     FormBorderStyle = FormBorderStyle.Sizable;
     _forceOnTop = false;
   }
   WindowState = FormWindowState.Normal;
   Location = location;
   ClientSize = clientSize;
   // We must restore the window state after having set the ClientSize/Location to make the window remember the
   // non-maximized bounds
   WindowState = maximize ? FormWindowState.Maximized : FormWindowState.Normal;
   _mode = mode;
 }
Exemplo n.º 38
0
        private void frmMain_Click(object sender, EventArgs e)
        {
            try
            {
                Point corrPos = new Point(MousePosition.X - Left, MousePosition.Y - Top);
                if (_client != null && _client.ConnectionStatus == NefitConnectionStatus.Connected)
                {
                    switch (_currentScreenMode)
                    {
                        default:
                        {
                            if (_temperatureUpClickZone.Contains(corrPos) || (_temperatureDownClickZone.Contains(corrPos)))
                            {
                                _displaySetpoint = _currentStatus.TemperatureSetpoint;
                                _currentScreenMode = ScreenMode.SetpointScreen;
                                _switchBackTicks = 3000;
                                Invalidate();
                            }

                            else if (_manualProgramClickZone.Contains(corrPos) && _currentStatus.UserMode == UserModes.Clock)
                            {
                                _client.SetUserMode(UserModes.Manual);
                            }
                            else if (_autoProgramClickZone.Contains(corrPos) && _currentStatus.UserMode == UserModes.Manual)
                            {
                                _client.SetUserMode(UserModes.Clock);
                            }
                            else if (_autoProgramClickZone.Contains(corrPos) && _currentStatus.UserMode == UserModes.Clock || (_manualProgramClickZone.Contains(corrPos) && _currentStatus.UserMode == UserModes.Manual))
                            {
                                _currentScreenMode = ScreenMode.BoilerScreen;
                                Invalidate();
                            }
                        }
                            break;
                        case ScreenMode.BoilerScreen:
                            if (_manualProgramClickZone.Contains(corrPos))
                            {
                                _currentScreenMode = ScreenMode.MainScreen;
                                Invalidate();
                            }
                            else if (_boilerOffZone.Contains(corrPos))
                            {
                                if (_currentStatus.UserMode == UserModes.Clock)
                                {
                                    _client.SetHotWaterModeClockProgram(false);
                                }
                                else
                                {
                                    _client.SetHotWaterModeManualProgram(false);
                                }
                            }
                            else if (_boilerOnZone.Contains(corrPos))
                            {
                                if (_currentStatus.UserMode == UserModes.Clock)
                                {
                                    _client.SetHotWaterModeClockProgram(true);
                                }
                                else
                                {
                                    _client.SetHotWaterModeManualProgram(true);
                                }
                            }
                            break;
                        case ScreenMode.SetpointScreen:
                            _switchBackTicks = 3000;
                            if (_temperatureUpClickZone.Contains(corrPos))
                            {
                                _displaySetpoint += _temperatureStep;
                                Invalidate();
                            }
                            else if (_temperatureDownClickZone.Contains(corrPos))
                            {
                                _displaySetpoint -= _temperatureStep;
                                Invalidate();
                            }
                            break;
                    }
                }
                if (_contextMenu.Contains(corrPos))
                {
                    ctxSettings.Show(MousePosition);
                }
            }
            catch
            {
            }
        }
Exemplo n.º 39
0
        private async void tmrUpdate_Tick(object sender, EventArgs e)
        {
            try
            {
                if (_switchBackTicks > 0 && _currentScreenMode == ScreenMode.SetpointScreen)
                {
                    _switchBackTicks -= 1000;
                    if (_switchBackTicks <= 0)
                    {
                        if (_currentStatus!=null && _displaySetpoint != _currentStatus.TemperatureSetpoint)
                        {
                            _client.SetTemperature(_displaySetpoint);
                        }
                        _currentScreenMode = ScreenMode.MainScreen;
                        Invalidate();
                    }
                }
                if (_client.ConnectionStatus == NefitConnectionStatus.Connected)
                {
                    UIStatus stat = await _client.GetUIStatusAsync();
                    //UIStatus stat =_client.ParseUIStatus();
                    if (stat != null)
                    {
                        _currentStatus = stat;
                        Invalidate();
                    }
                    if ((_currentProgram == null && stat != null && stat.ClockProgram == ClockProgram.Auto) || (_currentProgram != null && stat != null && _currentProgram.Length > 1 && (DateTime.Now >= _currentProgram[1].Timestamp)))
                    {
                        if (_currentStatus.HedEnabled)
                        {
                            _currentProgram = await _client.ProgramAsync(2);
                        }
                        else
                        {
                            int program = await _client.GetActiveProgramAsync();
                            if (program >= 0 && program <= 2)
                            {
                                _currentProgram = await _client.ProgramAsync(program);
                            }
                        }
                        Invalidate();                      
                    }

                    if (!_temperatureStepDetermined)
                    {
                        _temperatureStep = await _client.EasyTemperatureStepAsync();
                        if (!double.IsNaN(_temperatureStep))
                        {
                            _temperatureStepDetermined = true;
                        }
                        else
                        {
                            _temperatureStep = 0.5;
                        }
                    }
                }
            }
            catch
            {
            }
        }
 /// <summary>
 /// Sets the menu icon correctly.
 /// </summary>
 /// <param name="newMode"></param>
 private void SetupScreenModeForNewContext(ScreenMode newMode)
 {
     FlipViewPostContext context = GetContext();
     if(context == null)
     {
         return;
     }
     context.PostMenuIconVisibility = newMode == ScreenMode.Single ? Visibility.Visible : Visibility.Collapsed;
 }
Exemplo n.º 41
0
 public ScreenManager(ScreenMode sm, bool fs)
 {
     holdScreen = null;
     //changeResolution(ScreenMode.WXGA, false);
     changeResolution(sm, fs);
 }
Exemplo n.º 42
0
		public void WriteCss()
		{
			if (MediaType.ToLower() == "web" && IsPropertyModified() == true)
			{
				if (ValidateWebAttributes())
				{
					_validateWebInput = true;
					XmlNodeList baseNodeList = Param.GetItems("//styles/" + MediaType + "/style[@name='" + StyleName + "']/styleProperty");
					HashUtilities hashUtil = new HashUtilities();
					hashUtil.Key = "%:#@?,*&";
					hashUtil.Salt = "$%^&*#$%";
					foreach (XmlNode baseNode in baseNodeList)
					{
						string attribName = baseNode.Attributes["name"].Value.ToLower();
						SetAttributesForWebProperties(attribName, baseNode, hashUtil);
					}
					Param.Write();
				}
				else
				{
					_validateWebInput = false;
					return;
				}
			}

			if (IsPropertyModified() == false || (FileType.ToLower() == "standard")) return;
			if (MediaType.ToLower() != "web")
			{
				try
				{
					string path = Param.Value["UserSheetPath"]; // all user path
					string file = Common.PathCombine(path, FileName);
					string importStatement = string.Empty;

					if (File.Exists(file))
					{
						//Reading the existing file for 1st Line (@import statement)
						var sr = new StreamReader(file);
						while ((importStatement = sr.ReadLine()) != null)
						{
							if (importStatement.Contains("@import"))
							{
								break;
							}
						}
						sr.Close();
					}

					//Start Writing the Changes
					var writeCss = new StreamWriter(file);
					if (!string.IsNullOrEmpty(importStatement))
						writeCss.WriteLine(importStatement);

					// changes for paper media
					if (MediaType == "paper")
					{
						SetAttributesForPaperProperties(writeCss);
					}
					// write out the changes
					writeCss.Flush();
					writeCss.Close();

					PreviewFileName1 = "";
					PreviewFileName2 = "";

					if (cTool.StylesGrid.Rows.Count >= SelectedRowIndex)
					{
						if (PreviewFileName1.Trim().Length > 0 && PreviewFileName2.Trim().Length > 0)
						{
							cTool.StylesGrid[PreviewFile1, SelectedRowIndex].Value = PreviewFileName1;
							cTool.StylesGrid[PreviewFile2, SelectedRowIndex].Value = PreviewFileName2;
							XmlNode baseNode =
								Param.GetItem("//styles/" + MediaType + "/style[@name='" + StyleName + "']");
							Param.SetAttrValue(baseNode, "previewfile1", PreviewFileName1);
							Param.SetAttrValue(baseNode, "previewfile2", PreviewFileName1);
							Param.Write();
						}
					}
				}
				catch (Exception ex)
				{
					var confirmationStringMessage = LocalizationManager.GetString("ConfigurationToolBL.NoDuplicateStyleName.Message",
						"Sorry, your recent changes cannot be saved because Pathway cannot find the stylesheet file '{0}'", "");
					confirmationStringMessage = string.Format(confirmationStringMessage, ex.Message);
					var caption = LocalizationManager.GetString("ConfigurationToolBL.MessageBoxCaption.Caption", _caption, "");
					Utils.MsgBox(confirmationStringMessage, caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
									MessageBoxDefaultButton.Button1);
				}
			}
			_screenMode = ScreenMode.Edit;
		}
Exemplo n.º 43
0
 private static extern Status SetMode(double lcdUid, ScreenMode state);
Exemplo n.º 44
0
 private void AddToBuffer(ScreenMode lastdetected)
 {
     //loop overwrite
     _bufferIterator = (_bufferIterator == _screenstatusarray.Length) ? 0 : _bufferIterator;
     _screenstatusarray[_bufferIterator] = lastdetected;
     _bufferIterator++;
 }
Exemplo n.º 45
0
 private void StartMainScreen()
 {
     RemoveOldScreen();
     _mainWindow = new LoopScreen(); //bad perf, but less problems
        // if (_mainWindow == null) { _mainWindow = new LoopScreen(); }
     _mainWindow.StartDisplay(StopLastScreenAndGetLastTravel());
     _currentScreen = ScreenMode.MainScreen;
     Grid.SetRow(_mainWindow, 1);
     GridX.Children.Add(_mainWindow);
 }
Exemplo n.º 46
0
        public static void SetScreenMode(ScreenMode mode)
        {
            uint flag;
            if (mode == ScreenMode.Windowed)
                flag = 0;
            else if (mode == ScreenMode.Fullscreen)
                flag = (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN;
            else
                flag = (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP;

            SDL.SDL_SetWindowFullscreen(Game.WindowHandle, flag);
        }
Exemplo n.º 47
0
 public Resolution(GraphicsDeviceManager graphics, ScreenMode mode)
 {
     this.Mode = mode;
     this.baseMode = this.currentMode;
     SetResolution(graphics);
 }
Exemplo n.º 48
0
        /// <summary>
        /// Does the screen size changed logic, must be called under lock.
        /// </summary>
        /// <param name="newMode"></param>
        private void ExecuteOnScreenSizeChagnedLogic(ScreenMode newMode)
        {
            // Set the mode
            m_screenMode = newMode;

            // Update the panel sizes.
            UpdatePanelSizes();

            // We either showed a window or hide one, we need to tell that window.
            // If we are full screen don't tell anyone anything, the world will be restored
            // when we leave full screen.
            if(m_panelStack.Count > 1)
            {
                PanelType topPanelType = GetPanelType(m_panelStack.Last().Panel);

                IPanel mostRecentOtherPanel = null;
                // Find the most recent panel of a different type.
                foreach (StackItem item in m_panelStack.Reverse<StackItem>())
                {
                    IPanel panel = item.Panel;
                    // If the are both subreddit panels or both not, we found the panel.
                    if (GetPanelType(panel) != topPanelType)
                    {
                        mostRecentOtherPanel = panel;
                        break;
                    }
                }

                // Make sure we got one.
                if(mostRecentOtherPanel != null)
                {
                    if(m_screenMode == ScreenMode.Single)
                    {
                        // We hide it
                        FireOnNavigateFrom(mostRecentOtherPanel);
                    }
                    else
                    {
                        // We showed it
                        FireOnNavigateTo(mostRecentOtherPanel);
                    }
                }
            }

            FireOnScreenModeChanged();
        }
Exemplo n.º 49
0
 protected void SwitchToWindowedSize(Point location, Size clientSize, bool maximize)
 {
   WindowState = FormWindowState.Normal;
   FormBorderStyle = FormBorderStyle.Sizable;
   Location = location;
   ClientSize = clientSize;
   // We must restore the window state after having set the ClientSize/Location to make the window remember the
   // non-maximized bounds
   WindowState = maximize ? FormWindowState.Maximized : FormWindowState.Normal;
   _mode = ScreenMode.NormalWindowed;
 }
Exemplo n.º 50
0
 /// <summary>
 /// Set the screen state depending on which mode it's in
 /// </summary>
 private void SetScreenState(ScreenMode screenMode)
 {
     switch (screenMode)
     {
         case ScreenMode.Debug:
             WindowState = FormWindowState.Normal;
             FormBorderStyle = FormBorderStyle.Sizable;
             tmrKeepOnTop.Enabled = false;
             break;
         case ScreenMode.Fullscreen:
             WindowState = FormWindowState.Maximized;
             FormBorderStyle = FormBorderStyle.None;
             tmrKeepOnTop.Enabled = true;
             break;
         case ScreenMode.Windowed:
             WindowState = FormWindowState.Normal;
             FormBorderStyle = FormBorderStyle.None;
             tmrKeepOnTop.Enabled = true;
             break;
     }
     ControlBox = screenMode == ScreenMode.Debug;
 }
Exemplo n.º 51
0
 private async void Start()
 {
     _temperatureStepDetermined = false;
     _currentStatus = null;            
     _currentScreenMode = ScreenMode.MainScreen;
     _client = new NefitClient(Settings.Default.serial, Settings.Default.accessKey, Settings.Default.password);
     _client.XmlLog += Log;
     if (await _client.ConnectAsync())
     {
         tmrUpdate.Enabled = true;
         tmrUpdate_Tick(this,new EventArgs());
     }
     else if (_client.ConnectionStatus == NefitConnectionStatus.InvalidSerialAccessKey)
     {               
         MessageBox.Show(@"Authentication error: serial or accesskey invalid, please recheck your credentials", @"Authentication error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         settingsToolStripMenuItem_Click(this, new EventArgs());
     }
     else if (_client.ConnectionStatus == NefitConnectionStatus.InvalidPassword)
     {
         MessageBox.Show(@"Authentication error: password invalid, please recheck your credentials", @"Authentication error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         settingsToolStripMenuItem_Click(this, new EventArgs());
     }
 }
        //------------------------------------------------------------------------------
        // Method: SetScreenMode
        // Author: Neil Holmes & Andrew Green
        // Summary: helper function for setting full screen or windowed display mode
        //------------------------------------------------------------------------------
        public void SetScreenMode(ScreenMode screenMode)
        {
            // store the new screen mode
            currentScreenMode = screenMode;

            // process according to the new screen mode
            switch (currentScreenMode)
            {
                case ScreenMode.FullScreen:

                    // create a backbuffer that matches the resolution of the current display mode
                    graphicsDeviceManager.PreferredBackBufferWidth = (int)fullScreenDisplaySize.X;
                    graphicsDeviceManager.PreferredBackBufferHeight = (int)fullScreenDisplaySize.Y;
                    graphicsDeviceManager.IsFullScreen = true;
                    graphicsDeviceManager.ApplyChanges();
                    break;

                case ScreenMode.Windowed:

                    // create a backbuffer that matches the resolution of the current display mode
                    graphicsDeviceManager.PreferredBackBufferWidth = (int)windowedDisplaySize.X;
                    graphicsDeviceManager.PreferredBackBufferHeight = (int)windowedDisplaySize.Y;
                    graphicsDeviceManager.IsFullScreen = false;
                    graphicsDeviceManager.ApplyChanges();
                    break;
            }

            // calculate the display rectangle needed to fit the game to the requested display size
            CalculateDisplaySize();
        }
Exemplo n.º 53
0
 /// <summary>
 /// Sets the display mode
 /// </summary>
 /// <param name="mode">The <see cref="ScreenMode"/> to set the display to.</param>
 private void SetDisplayMode(ScreenMode mode)
 {
   Status res = SetMode(mediaPadLcdId, mode);
   if (res != Status.Success)
   {
     Log.Warn("MiniDisplay: Could not switch Mediapad to time mode ({0})", res.ToString());
   }
 }
        //------------------------------------------------------------------------------
        // Constructor: DisplayManager
        // Author: Neil Holmes & Andrew Green
        // Summary: creates the display manager and sets-up the back buffer and
        //          main render targets then sets the requested screen mode
        //------------------------------------------------------------------------------
        public DisplayManager(Game game, GameWindow window, GraphicsDeviceManager graphicsDeviceManager, int width, int height, ScreenMode screenMode, float renderScale)
        {
            int bestFullScreenWidth, bestFullScreenHeight;

            // store a reference to the parent game
            this.game = game;

            // store a reference to the parent window
            this.window = window;

            // store a reference to the parent game's graphics device manager
            this.graphicsDeviceManager = graphicsDeviceManager;

            // store a copy of the requested render scale
            this.renderScale = renderScale;

            // create the transform matrix using the requested render scale
            transformMatrix = Matrix.CreateScale(renderScale, renderScale, 1.0f);

            // tell the window that we want to allow resizing (remove if you don't want this!)
            window.AllowUserResizing = true;

            // stop the user from being able to make the window so small that we lose the graphics device ;)
            // this happens if the window height becomes zero so you can set the minimum size as low as you like as
            // long as you dont allow it to reach zero. if you turn off AllowUserResizing you dont need this
            System.Windows.Forms.Form.FromHandle(window.Handle).MinimumSize = new System.Drawing.Size(320, 240);

            // subscribe to the game window's ClientSizeChanged event - again not needed if you turn off user resizing
            window.ClientSizeChanged += new EventHandler<System.EventArgs>(WindowClientSizeChanged);

            // force vsync, because not doing so is UGLY and LAZY and BAD and developers that don't use it should be SHOT :P
            graphicsDeviceManager.SynchronizeWithVerticalRetrace = true;

            // run at max framerate allowed. you can set a fixed time step if you like but your game should really be set
            // up to run at any render speed or on slow machines it will all slow down, not just drop frames
            game.IsFixedTimeStep = false;

            // grab the pixel aspect ratio from the current desktop display mode - we'll assume that the user has this set
            // correctly for their monitor and use it to filter our full screen modes accordingly
            aspectRatio = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.AspectRatio;

            // store the requested game resolution
            gameResolution.X = width;
            gameResolution.Y = height;

            // set the prefered windowed size for the game to be the game resolution (take rendering scale into account)
            windowedDisplaySize.X = width * renderScale;
            windowedDisplaySize.Y = height * renderScale;

            // check that the prefered window size is not larger than the desktop - if it is make it 10% smaller than the desktop
            // size so that the user can actually see it all and mvoe it around/minimize/maximize it etc
            if (windowedDisplaySize.X > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width) windowedDisplaySize.X = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width * 0.9f;
            if (windowedDisplaySize.Y > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height) windowedDisplaySize.Y = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height * 0.9f;

            // find the most suitable full screen resolution (take rendering scale into account)
            FindBestFullScreenMode((int)(width * renderScale), (int)(height * renderScale), aspectRatio, out bestFullScreenWidth, out bestFullScreenHeight);
            fullScreenDisplaySize.X = bestFullScreenWidth;
            fullScreenDisplaySize.Y = bestFullScreenHeight;

            // set the requested screen mode (full screen or windowed)
            SetScreenMode(screenMode);

            // initialise the main render target and depth buffer that will be used for all game rendering
            mainRenderTarget = CreateMainRenderTarget(renderScale);

            // create the global sprite batch that we will use for doing all 2d rendering in the game
            globalSpriteBatch = new SpriteBatch(graphicsDeviceManager.GraphicsDevice);

            // load a blank texture to use for drawing black bars for letter boxed screen modes
            blankTexture = game.Content.Load<Texture2D>(@"System\Blank");

            // load a font we can use for displaying debug messages
            debugFont = game.Content.Load<SpriteFont>(@"System\DebugFont");
        }
Exemplo n.º 55
0
 private void StartSplashScreen()
 {
     RemoveOldScreen();
     if (_sscreen == null)
     {
         _sscreen = new StateViews.SplashScreen();
     }
     _sscreen.StartDisplay(StopLastScreenAndGetLastTravel());
     _currentScreen = ScreenMode.Splash;
     _sscreen.StartNewOfferTimer(Properties.Settings.Default.PictureChangeIntervallMS);
     Grid.SetRow(_sscreen, 1);
     GridX.Children.Add(_sscreen);
 }
Exemplo n.º 56
0
        public void changeResolution(ScreenMode inSM, bool inFullScreen)
        {
            Game1.graphics.PreferredBackBufferWidth = resolutions[(int)inSM, 0];
            Game1.graphics.PreferredBackBufferHeight = resolutions[(int)inSM, 1];

            Game1.graphics.IsFullScreen = inFullScreen;

            Game1.graphics.ApplyChanges();

            screenMode = inSM;
            isFullScreen = inFullScreen;

            screenSize = new Vector2(resolutions[(int)inSM, 0], resolutions[(int)inSM, 1]);
            screenSizeScale = ((screenSize / targetScreenSize).X + (screenSize / targetScreenSize).Y) / 2;
        }
Exemplo n.º 57
0
 protected void SwitchToFullscreen(int screenNum)
 {
   System.Windows.Forms.Screen[] screens = System.Windows.Forms.Screen.AllScreens;
   System.Windows.Forms.Screen screen = screenNum < 0 || screenNum >= screens.Length ?
       System.Windows.Forms.Screen.PrimaryScreen :
       System.Windows.Forms.Screen.AllScreens[screenNum];
   WindowState = FormWindowState.Normal;
   Rectangle rect = screen.Bounds;
   Location = rect.Location;
   ClientSize = rect.Size;
   FormBorderStyle = FormBorderStyle.None;
   _mode = ScreenMode.FullScreen;
 }
Exemplo n.º 58
0
 private void StartWalkScreen()
 {
     RemoveOldScreen();
     if (_walkScreen == null) { _walkScreen = new WalkScreen(); }
     _walkScreen.StartDisplay(StopLastScreenAndGetLastTravel());
     _currentScreen = ScreenMode.Walk;
     Grid.SetRow(_walkScreen, 1);
     GridX.Children.Add(_walkScreen);
 }
Exemplo n.º 59
0
    public void SwitchMode(ScreenMode mode)
    {
      if (InvokeRequired)
      {
        Invoke(new SwitchModeDelegate(SwitchMode), mode);
        return;
      }

      ServiceRegistration.Get<ILogger>().Debug("SkinEngine MainForm: Switching mode to {0}", mode);
      bool newFullscreen = mode == ScreenMode.FullScreen;
      AppSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<AppSettings>();

      // Already done, no need to do it twice.
      if (mode == _mode)
        return;

      settings.FullScreen = newFullscreen;
      ServiceRegistration.Get<ISettingsManager>().Save(settings);

      StopUI();

      _adaptToSizeEnabled = false;
      try
      {
        // Must be done before reset. Otherwise we will lose the device after reset.
        if (newFullscreen)
        {
          StoreClientBounds();
          SwitchToFullscreen(GetScreenNum());
        }
        else
          SwitchToWindowedSize(_previousWindowLocation, _previousWindowClientSize, _previousWindowState == FormWindowState.Maximized);
      }
      finally
      {
        _adaptToSizeEnabled = true;
      }
      SkinContext.WindowSize = ClientSize;

      Update();
      Activate();
      CheckTopMost();

      StartUI();
    }
        public void SetScreenMode(ScreenMode screenMode)
        {
            _screenMode = screenMode;

            if (screenMode == ScreenMode.GeneratePlaylist)
            {
                tblMain.RowStyles[0].SizeType = SizeType.Absolute;
                tblMain.RowStyles[0].Height = 0;
                btnOK.Visible = false;
            }
            else if (screenMode == ScreenMode.AutoGenerateSettings)
            {
                tblMain.RowStyles[2].SizeType = SizeType.Absolute;
                tblMain.RowStyles[2].Height = 0;
                btnStart.Visible = false;
                btnStop.Visible = false;
            }
        }