Example #1
0
        async void OnMenuFramePanUpdated(object sender, PanUpdatedEventArgs e)
        {
            // For some reason, it's extremely jumpy on Android.
            // I'm yet to investigate or ask the question why.

            double translationY = e.TotalY < 10 ? 10 : e.TotalY;

            if (e.StatusType == GestureStatus.Running)
            {
                System.Diagnostics.Debug.WriteLine(e.TotalY);

                MenuFrame.TranslationY = translationY;

                _penUltimateTranslationY = _lastTranslationY;
                _lastTranslationY        = e.TotalY;
            }

            if (e.StatusType == GestureStatus.Completed)
            {
                uint animationLength = 200;

                if (_penUltimateTranslationY < _lastTranslationY && !MenuFrame.TranslationY.Equals(10))
                {
                    await MenuFrame.TranslateTo(0, MenuFrame.Height, animationLength, Easing.CubicInOut);

                    ToggleOpaqueContainer(false, animationLength);
                }
                else
                {
                    MenuFrame.TranslateTo(0, 10, animationLength, Easing.CubicInOut);
                }
            }
        }
        private new void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            base.ListView_SelectionChanged(sender, e);
            var selectedItem = Model.SelectedItem as ListMenuItemVm;

            MenuFrame?.Navigate(selectedItem == null ? typeof(SettingsWelcomePage) : selectedItem.PageType);
        }
Example #3
0
 public MainWindow()
 {
     InitializeComponent();
     MenuFrame.Navigate(new Rasp());
     Manager.MainFrame  = MenuFrame;
     LabelInfo.Content += "Пользователь: " + NameUser + " " + SurnameUser + "\nГруппа: " + Manager.GroupDefault;
 }
Example #4
0
        private void LoadGui()
        {
            _guiCamera     = new Camera2D();
            _resultsScreen = new ResultsScreen(teamsSelected);
            _guiFrame      = new MenuFrame(new Rectangle(0, 0, (int)GameSettings.ScreenWidth - 6, (int)GameSettings.ScreenHeight), "Menu", new Rectangle(0, 0, 16, 16));
            _guiFrame.AddHorizontalLine(16, (int)GameSettings.ScreenWidth - 22, (int)(2 * 32));
            _guiFrame.AddSplit(0, (int)(2 * 32), MenuFrame.SplitType.Right);
            _guiFrame.AddSplit((int)GameSettings.ScreenWidth - 22, (int)(2 * 32), MenuFrame.SplitType.Left);
            for (int i = 1; i <= 2; i++)
            {
                _guiFrame.AddSplit((i * 290), 0, MenuFrame.SplitType.Down);
                _guiFrame.AddSplit((i * 290), (int)(2 * 32), MenuFrame.SplitType.Up);
                _guiFrame.AddVerticalLine((i * 290), 16, 2 * 32);
            }
            for (int i = 3; i <= 4; i++)
            {
                _guiFrame.AddSplit((i * 290) - 90, 0, MenuFrame.SplitType.Down);
                _guiFrame.AddSplit((i * 290) - 90, (int)(2 * 32), MenuFrame.SplitType.Up);
                _guiFrame.AddVerticalLine((i * 290) - 90, 16, 2 * 32);
            }

            _guiFrame.LoadContent(_contentManager);


            _wonText       = new SpriteText("BigFont", "Player won", new Vector2(300, 300));
            _wonText.Depth = 1f;
            _wonText.color = Color.White;
            _wonText.LoadContent(_contentManager);
            _wonText.CenterText(new Rectangle((int)camera.Position.X, (int)camera.Position.Y, (int)GameSettings.ScreenWidth, (int)GameSettings.ScreenHeight), true, true);
            _wonText.Hide();

            _timerFont = new SpriteText("HealthFont", "Time: ", new Vector2(0, 0));
            _timerFont.LoadContent(_contentManager, _spriteBatch);
            _timerFont.CenterText(new Rectangle(0, 16, (int)GameSettings.ScreenWidth, 16 * 3), true, true);
        }
Example #5
0
        public override void LoadContent()
        {
            base.LoadContent();
            screenManager.ClearColor = Color.Black;
            _font = _contentManager.Load <SpriteFont>("Font1");

            for (int i = 0; i < 10; i++)
            {
                _tankSprites[i]        = new Sprite("Sprites", 0, 0, new Rectangle(96 + (32 * i), 112, 32, 32), 1);
                _tankSprites[i].Origin = new Vector2(16, 16);
                _tankSprites[i].LoadContent(_contentManager, _spriteBatch);
                _tankSprites[i].Hide();
                _tankSprites[i].rotation = _currentRotation;
            }
            for (int i = 0; i < 4; i++)
            {
                _selectedTeams[i] = -1;
            }
            _menuFrame = new MenuFrame(new Rectangle(80, 180, 1200, 320), "Menu", new Rectangle(0, 0, 16, 16));
            for (int i = 1; i < 4; i++)
            {
                _menuFrame.AddSplit((i * 300) + 80, 180, MenuFrame.SplitType.Down);
                _menuFrame.AddSplit((i * 300) + 80, 500 - 16, MenuFrame.SplitType.Up);
                _menuFrame.AddVerticalLine((i * 300) + 80, 196, 500 - 16);
            }

            _menuFrame.LoadContent(_contentManager);
        }
        private new void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            base.ListView_SelectionChanged(sender, e);

            if (!(Model.SelectedItem is MainMenuItemVm selectedItem))
            {
                MenuFrame.Navigate(typeof(WelcomePage));
            }
        public MainPage()
        {
            this.InitializeComponent();
            MenuFrame.Navigate(typeof(FlightView));
            TitleTextBlock.Text = "Flights";
            Windows.UI.ViewManagement.ApplicationView appView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
            appView.SetPreferredMinSize(new Size(300, 300));

            this.SizeChanged += MainPage_SizeChanged;
        }
Example #8
0
        public MainPage()
        {
            this.InitializeComponent();
            MenuFrame.Navigate(typeof(SearchPage));

            var update = new Action(() =>
            {
                // update radiobuttons after frame navigates
                var type = MenuFrame.CurrentSourcePageType;
                foreach (var radioButton in AllRadioButtons(this))
                {
                    var target = radioButton.CommandParameter as NavType;
                    if (target == null)
                    {
                        continue;
                    }
                    radioButton.IsChecked = target.Type.Equals(type);
                }
                switch (HamburgerSplitView.DisplayMode)
                {
                case SplitViewDisplayMode.CompactOverlay:
                case SplitViewDisplayMode.Overlay:
                    HamburgerSplitView.IsPaneOpen = false;
                    break;

                case SplitViewDisplayMode.CompactInline:
                default:
                    break;
                }
                // BackCommand.RaiseCanExecuteChanged();
            });

            MenuFrame.Navigated += (s, e) => update();
            Loaded     += (s, e) => update();
            DataContext = this;

            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility
                = Windows.UI.Core.AppViewBackButtonVisibility.Visible;

            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) =>
            {
                if (MenuFrame.CanGoBack)
                {
                    if (!e.Handled)
                    {
                        e.Handled = true;
                        MenuFrame.GoBack();
                    }
                }
            };
        }
Example #9
0
        private new void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            base.ListView_SelectionChanged(sender, e);

            var selectedItem = Model.SelectedItem as MainMenuItemVm;

            if (selectedItem == null)
            {
                MenuFrame.Navigate(typeof(WelcomePage));
            }
            else
            {
                selectedItem.Destination.Navigate(selectedItem.PageType, selectedItem.Parameter);
            }
        }
Example #10
0
    public override void doAction(bool active)
    {
        objectToActivate.SetActive(active);
        MenuFrame mf = objectToActivate.GetComponent <MenuFrame>();

        if (active && mf)
        {
            mf.init();
            mf.frameCamera();
            MenuManager mm = Managers.Menu;
            if (!mm.frames.Contains(mf))
            {
                mm.frames.Add(mf);
            }
        }
    }
Example #11
0
        private void ExecuteNav(NavType navType)
        {
            MenuFrame.Navigate(navType.Type);

            // when we nav home, clear history
            if (navType.Type.Equals(typeof(SearchPage)))
            {
                MenuFrame.BackStack.Clear();
            }

            // navigate only to new pages
            if (MenuFrame.Content != null && MenuFrame.Content.GetType() != navType.Type)
            {
                MenuFrame.Navigate(navType.Type, navType.Parameter);
            }
        }
 private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (FlightView.IsSelected)
     {
         MenuFrame.Navigate(typeof(FlightView));
         TitleTextBlock.Text = "Flights";
     }
     else if (AircraftView.IsSelected)
     {
         MenuFrame.Navigate(typeof(AircraftView));
         TitleTextBlock.Text = "Aircrafts";
     }
     else if (AircraftTypeView.IsSelected)
     {
         MenuFrame.Navigate(typeof(AircraftTypeView));
         TitleTextBlock.Text = "Aircraft types";
     }
     else if (DepartureView.IsSelected)
     {
         MenuFrame.Navigate(typeof(DepartureView));
         TitleTextBlock.Text = "Departures";
     }
     else if (CrewView.IsSelected)
     {
         MenuFrame.Navigate(typeof(CrewView));
         TitleTextBlock.Text = "Crews";
     }
     else if (PilotView.IsSelected)
     {
         MenuFrame.Navigate(typeof(PilotView));
         TitleTextBlock.Text = "Pilots";
     }
     else if (StewardessView.IsSelected)
     {
         MenuFrame.Navigate(typeof(StewardessView));
         TitleTextBlock.Text = "Stewardesses";
     }
     else if (TicketView.IsSelected)
     {
         MenuFrame.Navigate(typeof(TicketView));
         TitleTextBlock.Text = "Tickets";
     }
 }
        public RadioMiniControlBarComponent(IDrawingContext ctx) : base(ctx)
        {
            BackgroundColor = StaticColors.COLOR_FOREGROUND_BG;
            Height          = 70;
            Padding         = 10;
            IsMenu          = true;

            //Make parts
            freqControl = AddLabeledComponent("Tuning", new LongNumberSelectorComponent(this, 3 * 4, SDR.CenterFrequency))
                          .SetMaxValue(int.MaxValue)
                          .SetMinValue(10)
                          .SetValueChangeEvent((long freq) => SDR.CenterFrequency = freq);
            bandwidthControl = AddLabeledComponent("Bandwidth", new LongNumberSelectorComponent(this, 3 * 2, (long)SDR.Bandwidth))
                               .SetMaxValue(250000)
                               .SetMinValue(1000)
                               .SetValueChangeEvent((long bandwidth) => SDR.Bandwidth = bandwidth);
            demodControl = AddLabeledComponent("Mode", new DropdownControlComponent(this, (int)SDR.DemodMode, "WbFm", "AM"))
                           .SetValueChangeEvent((int mode) => SDR.DemodMode = (SdrDemodMode)mode);
            AddChild(new ControlBarButtonComponent(this, "MORE", () => MenuFrame.ShowMenu()), AlignHorizontal.Right);
        }
Example #14
0
        public ResultsScreen(int[] teams)
            : base(ScreenType.ActivePopup)
        {
            Rectangle position = new Rectangle((int)(32 * 16),
                                               (int)(10 * 16),
                                               (int)(21 * 16),
                                               (int)(80 * 4));
            Rectangle menuRectangle = new Rectangle(0, 0, 16, 16);

            _resultsFrame = new MenuFrame(position, "Menu", menuRectangle);
            _tankSprites  = new Sprite[teams.Length];
            int numberOfPlayers = 0;

            for (int i = 0; i < teams.Length; i++)
            {
                _tankSprites[i] = new Sprite("Sprites", 0, 0, 1);
                _tankSprites[i].SetTextureRectangle(new Rectangle(96 + (32 * teams[i]), 112, 32, 32));
                numberOfPlayers = teams[i] == -1 ? numberOfPlayers : numberOfPlayers + 1;
            }
            _progressBars = new HealthBar[numberOfPlayers];
            _resultsFrame.AddSplit(_resultsFrame.XPos, _resultsFrame.YPos + 64, MenuFrame.SplitType.Right);
            _resultsFrame.AddSplit(_resultsFrame.XPos + _resultsFrame.Width - 16, _resultsFrame.YPos + 64, MenuFrame.SplitType.Left);
            _resultsFrame.AddHorizontalLine(_resultsFrame.XPos + 16, _resultsFrame.XPos + _resultsFrame.Width - 16, _resultsFrame.YPos + 64);
        }
Example #15
0
        public override void LoadContent()
        {
            base.LoadContent();
            screenManager.ClearColor = Color.Black;
            _font = _contentManager.Load<SpriteFont>("Font1");

            for (int i = 0; i < 10; i++)
            {
                _tankSprites[i] = new Sprite("Sprites", 0,0, new Rectangle(96 + (32 * i), 112, 32, 32), 1);
                _tankSprites[i].Origin = new Vector2(16, 16);
                _tankSprites[i].LoadContent(_contentManager, _spriteBatch);
                _tankSprites[i].Hide();
                _tankSprites[i].rotation = _currentRotation;
            }
            for (int i = 0; i < 4; i++) _selectedTeams[i] = -1;
            _menuFrame = new MenuFrame(new Rectangle(80, 180, 1200, 320), "Menu",new Rectangle(0,0,16,16));
            for(int i = 1;i<4;i++)
            {
                _menuFrame.AddSplit((i * 300) + 80, 180,MenuFrame.SplitType.Down);
                _menuFrame.AddSplit((i * 300) + 80, 500-16, MenuFrame.SplitType.Up);
                _menuFrame.AddVerticalLine((i * 300) + 80, 196, 500-16);
            }

            _menuFrame.LoadContent(_contentManager);
        }
Example #16
0
        static void Main(string[] args)
        {
            if (RunAutoUpdate(args))
            {
                //ถ้าใน method RunAutoUpdate ทำงาน
                //แล้ว return true; แปลว่า ให้มัน run autoupdate เฉยๆ ไม่ต้อง new thread
                //เพราะauto update จะจัดการเปิดโปรแกรมให้ใหม่
                //(ซึ่ง autoupdate จะ set param ให้เวลา run อีกรอบ จะทำให้ method return false

                //แต่ถ้า return false; แปลว่าหา path ไม่เจอ ก็ให้มันทำงานได้เลย
            }
            else
            {
                //Set default culture to English-United state
                //set default date to dd/MM/yyyy
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");

                CultureInfo culture = new System.Globalization.CultureInfo("en-US");
                culture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
                culture.DateTimeFormat.ShortTimePattern = "HH:mm";
                culture.DateTimeFormat.LongTimePattern  = "HH:mm:ss";
                culture.DateTimeFormat.DateSeparator    = "/";
                Thread.CurrentThread.CurrentCulture     = culture;


                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);

                // Enter life-cycle main form.
                try
                {
                    while (true)
                    {
                        LoginForm form = new LoginForm();
                        if (form.ShowDialog() == DialogResult.Cancel)
                        {
                            return;
                        }

                        //UserController userController = new UserController();
                        //if (!userController.Login("SYSTEM".ToNZString(), "SYSTEM".ToNZString()))
                        //    return;

                        //=========================
                        LoadConfiguration();

#warning Injection to load plugins
                        string path = System.IO.Path.Combine(Application.StartupPath, @"Rubik.Forms.DLL");
                        InternalScreenCache.GetInstance().LoadScreensFromAssembly(path);

                        try
                        {
                            Assembly tkpFormAsm = Assembly.LoadFile(path);
                            Common.Version.Value    = tkpFormAsm.GetName().Version.ToString();
                            Common.UpdateDate.Value = GetBuildDate(tkpFormAsm.GetName().Version);

                            //FileInfo tkpFileInfo = new FileInfo(path);
                            //Common.UpdateDate.Value = tkpFileInfo.CreationTime.ToString("yyyy/MM/dd");
                            //Common.UpdateDate.Value = DataDefine.PROGRAM_DATE;
                        }
                        catch (Exception err)
                        {
                            System.Diagnostics.Debug.WriteLine(err.Message);
                            Common.Version.Value    = string.Empty;
                            Common.UpdateDate.Value = string.Empty;
                        }

                        // --------------
                        Thread LoadReportTread = new Thread(new ThreadStart(LoadDummyReport));
                        LoadReportTread.Start();
                        // ==============

                        m_menuFrame = new MenuFrame();

                        Application.Run(m_menuFrame);

                        // if user choose to close menu form, terminate application.
                        if (!m_menuFrame.IsLogout)
                        {
                            return;
                        }
                    }  // end while
                }
                catch (ValidateException err)
                {
                    MessageDialog.ShowBusiness(null, err.ErrorResults[0].Message);
                    if (m_menuFrame != null && !m_menuFrame.IsDisposed)
                    {
                        m_menuFrame.Dispose();
                    }
                }
                catch (BusinessException err)
                {
                    MessageDialog.ShowBusiness(null, err.Error.Message);
                    if (m_menuFrame != null && !m_menuFrame.IsDisposed)
                    {
                        m_menuFrame.Dispose();
                    }
                }
                catch (Exception err)
                {
                    Console.WriteLine(err.Message);

                    //MessageDialog.ShowSingleItem(null, "Error", err.StackTrace, MessageDialogIcon.Error);
                    ErrorDialog errorDialog = new ErrorDialog();
                    errorDialog.Message    = @"Connection failed. " + System.Environment.NewLine + err.Message;
                    errorDialog.StackTrace = err.StackTrace;
                    errorDialog.ShowDialog();

                    if (m_menuFrame != null && !m_menuFrame.IsDisposed)
                    {
                        m_menuFrame.Dispose();
                    }


                    //TODO: Remark LoginForm for customer TAKEI
                    Application.ExitThread();
                    Application.Restart();
                }
            }
        }
Example #17
0
 private void StackPanel_Tapped(object sender, TappedRoutedEventArgs e)
 {
     MenuFrame.Navigate(typeof(Theme));
     ShowMenu(false, (StackPanel)sender);
 }
Example #18
0
 async Task DoShowMenu()
 {
     ToggleOpaqueContainer(true, 300);
     MenuFrame.TranslateTo(0, MenuFrame.CornerRadius, 300, Easing.CubicInOut);
 }
Example #19
0
        public override void LoadContent()
        {
            base.LoadContent();
            screenManager.Game.IsMouseVisible = false;
            ShapeRenderer.graphicsDevice = screenManager.GraphicsDevice;
            screenManager.ClearColor = Color.Black;
            Tile.InitializeTilePreferences();
            usingSplitScreen = false;

            Map.TileSize = cTileSize;
            MapGenerator.Initialize();
            _currentMap = MapGenerator.GenerateRoguelikeMap(MapWidth, MapHeight);
            _currentMap.LoadContent(_contentManager);

            SetStartingPositions(MapWidth, MapHeight);
            SetViewPorts(numberOfPlayers);
            camera.Zoom = 0.99f;
            camera.Move(new Vector2(-16, -80));

            _guiFrame = new MenuFrame(new Rectangle(0, 0, (int)GameSettings.ScreenWidth - 6, (int)GameSettings.ScreenHeight), "Menu", new Rectangle(0, 0, 16, 16));
            _guiFrame.AddHorizontalLine(16, (int)GameSettings.ScreenWidth - 22, (int)(2 * 32));
            _guiFrame.AddSplit(0, (int)(2 * 32), MenuFrame.SplitType.Right);
            _guiFrame.AddSplit((int)GameSettings.ScreenWidth - 22, (int)(2 * 32), MenuFrame.SplitType.Left);
            for (int i = 1; i <= 2; i++)
            {
                _guiFrame.AddSplit((i * 290), 0, MenuFrame.SplitType.Down);
                _guiFrame.AddSplit((i * 290), (int)(2 * 32), MenuFrame.SplitType.Up);
                _guiFrame.AddVerticalLine((i * 290), 16, 2 * 32);
            }
            for (int i = 3; i <= 4; i++)
            {
                _guiFrame.AddSplit((i * 290) - 90, 0, MenuFrame.SplitType.Down);
                _guiFrame.AddSplit((i * 290) - 90, (int)(2 * 32), MenuFrame.SplitType.Up);
                _guiFrame.AddVerticalLine((i * 290) - 90, 16, 2 * 32);
            }

            _guiFrame.LoadContent(_contentManager);
            _guiCamera = new Camera2D();

            _wonText = new SpriteText("BigFont", "Player won", new Vector2(300, 300));
            _wonText.Depth = 1f;
            _wonText.color = Color.White;
            _wonText.LoadContent(_contentManager);
            _wonText.CenterText(new Rectangle((int)camera.Position.X, (int)camera.Position.Y, (int)GameSettings.ScreenWidth, (int)GameSettings.ScreenHeight), true, true);
            _wonText.Hide();

            _timerFont = new SpriteText("HealthFont", "Time: ", new Vector2(0, 0));
            _timerFont.LoadContent(_contentManager, _spriteBatch);
            _timerFont.CenterText(new Rectangle(0, 16, (int)GameSettings.ScreenWidth, 16 * 3), true, true);

            for (int i = 0; i < numberOfPlayers; i++)
            {
                int randomPosition = random.Next(0, startingLocations.Count);
                _players[i] = new Tank(i, startingLocations[randomPosition].Item1, teamsSelected[i], usedControls[i], usedViewPorts[i].Bounds);
                _players[i].Rotation = startingLocations[randomPosition].Item2;
                _players[i].LoadContent(_contentManager, _spriteBatch);
                _players[i].ResetHealth();
                startingLocations.RemoveAt(randomPosition);
                if (!usingSplitScreen)
                {
                    _players[i].camera = this.camera;
                }

                _playersRemaining.Add(_players[i]);
            }

            PooledObjects.Initialize();
            PooledObjects.bullets.ForEach(b => b.LoadContent(_contentManager));
            PooledObjects.fragmentClusters.ForEach(fc => fc.LoadContent(_contentManager));
        }
Example #20
0
 async void HideMenu(object sender, System.EventArgs e)
 {
     MenuFrame.TranslateTo(0, MenuFrame.Height, 300, Easing.CubicIn);
     ToggleOpaqueContainer(false, 300);
 }