Update() private method

private Update ( ) : void
return void
コード例 #1
0
 /// <summary>
 /// Movimenta os Buttons entre os Panels
 /// </summary>
 /// <param name="result"></param>
 /// <param name="pDir"></param>
 /// <param name="pEsq"></param>
 /// <param name="pIce"></param>
 /// <param name="btns"></param>
 public void MoveButton(string[] result, Panel pDir, Panel pEsq, Panel pIce, List <Button> btns)
 {
     for (int i = 0; i < result.Length - 1; i++)
     {
         for (int j = 0; j < result[i].Length; j++)
         {
             if (result[i].ToString()[j] == 'I')
             {
                 pDir.Controls.Remove(btns[j]);
                 pIce.Controls.Add(btns[j]);
                 pDir.Update();
                 pDir.Show();
                 pIce.Update();
                 pIce.Show();
                 Thread.Sleep(90);
             }
             if (result[i].ToString()[j] == 'L')
             {
                 pIce.Controls.Remove(btns[j]);
                 pEsq.Controls.Add(btns[j]);
                 pIce.Update();
                 pIce.Show();
                 pEsq.Update();
                 pEsq.Show();
                 Thread.Sleep(90);
             }
         }
     }
 }
コード例 #2
0
 private void blinkPanel(Panel panel, Color firstColor, Color secondColor, int delay, int repeat)
 {
     for (int i = 0; i < repeat; i++)
     {
         panel.BackColor = firstColor;
         panel.Update();
         Thread.Sleep(delay);
         panel.BackColor = secondColor;
         panel.Update();
         Thread.Sleep(delay);
     }
 }
コード例 #3
0
        private void Form_Deactivated(object sender, EventArgs e)
        {                                                           //When the form goes into deactivated mode (loses focus) change the color of the title bar.
            pnlTitleBar.SuspendLayout();
            pnlTitleBar.BackColor = UIAppearance.DeactiveFormColor; //Set title bar backcolor
            this.BorderColor      = Colors.DefaultFormBorderColor;  //Set border color

            if (UIAppearance.Style == UIStyle.Supernova)            //If the style is supernova, change the icon color to white
            {
                btnFormIcon.IconColor = Color.WhiteSmoke;
            }
            pnlTitleBar.ResumeLayout();
            pnlTitleBar.Update();//Force draw the title bar to avoid flickering when the background color is changed.
        }
コード例 #4
0
 private void Form_Deactivated(object sender, EventArgs e)
 {//When the form goes into deactivated mode (loses focus) change the color of the title bar.
     if (deactivateFormEvent == true)
     {
         this.BorderColor = Colors.DefaultFormBorderColor;                                        //Set border color
         if (UIAppearance.Style != UIStyle.Supernova)                                             //If the style is not supernova, change the title bar color
         {
             pnlTitleBar.BackColor       = UIAppearance.DeactiveFormColor;                        //Set title bar backcolor
             pnlSideMenuHeader.BackColor = ColorEditor.Darken(UIAppearance.DeactiveFormColor, 6); //Set Side menu header backcolor
             pnlTitleBar.Update();                                                                //Force draw the title bar to avoid flickering when the background color is changed.
         }
     }
 }
コード例 #5
0
 public void Init()
 {
     label.TaskState  = MySQLTaskStatusLabelState.TaskOpen;
     resultLabel.Text = "";
     stageLabel.Text  = "";
     if (null != progressBar)
     {
         progressBar.Value = progressBar.Minimum;
     }
     if (null != progressDetailsLabel)
     {
         progressDetailsLabel.Text = "";
     }
     panel.Update();
 }
コード例 #6
0
        private async Task <int> blinkPanelAsync(Panel panel, Color firstColor, Color secondColor, int delay, int repeat)
        {
            for (int i = 0; i < repeat; i++)
            {
                panel.BackColor = firstColor;
                panel.Update();
                await TaskEx.Delay(delay);

                panel.BackColor = secondColor;
                panel.Update();
                await TaskEx.Delay(delay);
            }

            return(0);
        }
コード例 #7
0
        public void StartCurrentApp()
        {
            Width  = (int)(Screen.PrimaryScreen.WorkingArea.Width * 0.8f);
            Height = (int)(Screen.PrimaryScreen.WorkingArea.Height * 0.8f);

            Left = Screen.PrimaryScreen.Bounds.Width / 2 - Width / 2;
            Top  = Screen.PrimaryScreen.Bounds.Height / 2 - Height / 2;

            renderPanel.Update();

            //
            //  STEP ONE - Create the Winforms Control
            //
            currentControl = new RenderControl
            {
                BackColor = System.Drawing.Color.Black,
                Location  = new System.Drawing.Point(0, 0),
                Size      = renderPanel.Size,
                Dock      = DockStyle.Fill,
                Name      = "RenderControl",
                TabIndex  = 0
            };

            currentControl.HandleCreated += renderControl_HandleCreated; // <- This is crucial: Prepare for STEP TWO.

            renderPanel.Controls.Add(currentControl);
        }
コード例 #8
0
        internal void UpdateInternal(float delta, float total)
        {
            Update(delta, total);

            BackgroundGui?.Update();
            ForegroundGui?.Update();
        }
コード例 #9
0
        //Check Button Sold or Not
        public static void ButtonCheck(Panel panel)
        {
            Sale sale = new Sale();

            string[] bought_seat = sale.Bought_seat_id(selected_movie, selected_time, selected_date);
            for (int i = 0; i < bought_seat.Length; i++)
            {
                foreach (Control control in panel.Controls)
                {
                    if (control is Button temp)
                    {
                        if (temp.Enabled == true)
                        {
                            if (temp.Name == ("btn" + bought_seat[i]))
                            {
                                temp.Enabled = false;
                                temp.Text    = "Sold";
                                panel.Update();
                            }
                        }
                        else if (temp.Enabled == false)
                        {
                            if (temp.Name == ("btn" + bought_seat[i]))
                            {
                                temp.Enabled = true;
                                temp.Text    = bought_seat[i];
                            }
                        }
                    }
                }
            }
        }
コード例 #10
0
        protected override void Update(GameTime gameTime)
        {
            // Screen Size Changes:
            if (_screenSizeChanged)
            {
                _graphics.PreferredBackBufferWidth  = _screenWidth;
                _graphics.PreferredBackBufferHeight = _screenHeight;
                _graphics.ApplyChanges();
                _screenSizeChanged = false;

                ScreenWidth  = _screenWidth;
                ScreenHeight = _screenHeight;
            }


            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
                Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            // UPDATE HERE:
            TestPanel.Update(gameTime);
            ViewportBorder.Position = TestPanel.Viewport.Position;

            string test = "Viewport: " + TestPanel.Viewport.Bounds.ToString() + "\n";

            test += "View Pos: " + TestPanel.Viewport.Position.ToString() + "\n";
            test += "Panel: " + TestPanel.Position.ToString() + "\n";
            test += "Mouse: " + Mouse.GetState().Position.ToString() + "\n";

            LabelViewportBounds.Text = test;

            base.Update(gameTime);
        }
コード例 #11
0
            private void setPlayerVisible(bool isPlayerVisible)
            {
                Panel panel = getInactivePanel();

                panel.SendToBack();
                panelHost.Update();
            }
コード例 #12
0
ファイル: frmGameGUI.cs プロジェクト: blakephillips/Durak
        /// <summary>
        /// Aligns the cards in the panel depending on which game panel is passed to it
        /// </summary>
        /// <param name="panel"></param>
        void AlignCards(Panel panel)
        {
            //panel.Update();
            int panelWidth  = panel.Width;
            int panelHeight = panel.Height;
            int cardSpacing = CardBox.CARD_SIZE.Width;
            int padding     = 25;

            if (panel == pnlPlayerBottom || panel == pnlPlayerTop)
            {
                bool isBottomPanel = panel == pnlPlayerBottom;
                int  expectedWidth = panel.Controls.Count * cardSpacing;
                if (expectedWidth > panelWidth) //Cards will not fit in panel using default spacing
                {
                    // Total spacing adjustment equal to difference between panel width and required width (including padding)
                    cardSpacing -= (expectedWidth - panelWidth + (padding * 2)) / panel.Controls.Count;

                    // Calculate expected width using card count and spacing
                    // Remember, last card is on top therefor full-width
                    expectedWidth = (panel.Controls.Count - 1) * cardSpacing + CardBox.CARD_SIZE.Width;
                }
                // Apply new locations to cards
                for (int i = 0; i < panel.Controls.Count; i++)
                {
                    // Initial x-position is half the remaining panel width
                    int leftMargin = (panel.Width - expectedWidth) / 2;
                    panel.Controls[i].Location = new Point(leftMargin + (i * cardSpacing), isBottomPanel ? panelHeight - CardBox.CARD_SIZE.Height : 0);
                }
                panel.Update();
            }
            else if (panel == pnlPlayArea)
            {
                cardSpacing = CardBox.CARD_SIZE.Width / 2;
                int duoSpacing = 50;
                int duoCount   = ((panel.Controls.Count - 1) / 2 > 0) ? (panel.Controls.Count - 1) / 2 : 0;

                int expectedWidth = (panel.Controls.Count - 1) * cardSpacing + (duoCount * duoSpacing) + CardBox.CARD_SIZE.Width;
                int leftMargin    = (panelWidth - expectedWidth) / 2;
                int alignBottom   = panel.Height - CardBox.CARD_SIZE.Height;
                for (int i = 0; i < panel.Controls.Count; i++)
                {
                    if (i > 0 && i % 2 == 0)
                    {
                        leftMargin += duoSpacing;
                    }
                    int aiSide = Convert.ToInt32(durakGame.GetAttacker().GetType() == typeof(Player));
                    if (i % 2 == aiSide)
                    {
                        panel.Controls[i].Location = new Point(leftMargin + (i * cardSpacing), 0);
                    }
                    else
                    {
                        panel.Controls[i].Location = new Point(leftMargin + (i * cardSpacing), alignBottom);
                    }
                    panel.Controls[i].Update();
                }
            }
        }
コード例 #13
0
        public void Update(GameTime gameTime)
        {
            //сначала с чем сталкиваемся потом что сталкиваем
            if (TennisBall.IntersectsPixel(TennisBall.BallRectangle, TennisBall.BallTextureData, Panel.PanelRectangle, Panel.PanelTextureData))
            {
                TennisBall.Update(gameTime);
            }
            else if (TennisBall.IntersectsPixel(TennisBall.BallRectangle, TennisBall.BallTextureData, JumpButton.PanelRectangle, JumpButton.PanelTextureData))
            {
                TennisBall.BallVelocity *= 2f;
                TennisBall.Update(gameTime);
            }
            else if (EndBlock.IntersectsPixel(TennisBall.BallRectangle, TennisBall.BallTextureData, EndBlock.PanelRectangle, EndBlock.PanelTextureData))
            {
                TennisBall.Update(gameTime);
                finished = true;
            }
            else
            {
                TennisBall.Update(gameTime);
            }

            if (JumpButton.IntersectsPixel(cursorRectangle, cursorTextureData, JumpButton.PanelRectangle, JumpButton.PanelTextureData) &&
                Mouse.GetState().LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed && !TennisBall.started)
            {
                float x, y;
                x = JumpButton.PanelPosition.X - mouse.X;
                y = JumpButton.PanelPosition.Y - mouse.Y;
                JumpButton.PanelPosition.X = Mouse.GetState().X + x;
                JumpButton.PanelPosition.Y = Mouse.GetState().Y + y;
            }
            if (gui.Start.IntersectsPixel(cursorRectangle, cursorTextureData, gui.Start.ButtonRectangle, gui.Start.ButtonTextureData) &&
                mouse.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            {
                TennisBall.started = true;
            }
            if (gui.Stop.IntersectsPixel(cursorRectangle, cursorTextureData, gui.Stop.ButtonRectangle, gui.Stop.ButtonTextureData) &&
                mouse.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            {
                TennisBall.started = false;
            }
            if (gui.Hint.IntersectsPixel(cursorRectangle, cursorTextureData, gui.Hint.HRectangle, gui.Hint.HTextureData) &&
                Mouse.GetState().LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed && TennisBall.started == false)
            {
                MessageBox.Show("Фиолетовый ускоритель поможет мячику забраться\n" +
                                "выше если его правильно использовать.\n", "Подсказка #4", MessageBoxButtons.OK);
            }
            Panel.Update(gameTime);
            JumpButton.Update(gameTime);

            EndBlock.Update(gameTime);

            gui.Update(gameTime);
            mouse           = Mouse.GetState();
            cursorRectangle = new Rectangle(mouse.X - (cursorTexture.Width / 2),
                                            mouse.Y - (cursorTexture.Height / 2), cursorTexture.Width, cursorTexture.Height);
        }
コード例 #14
0
        private void SelectGroup_Click(object sender, EventArgs e)
        {
            var combo = (ComboBox)sender;
            var group = (LaunchConfigGroup)combo.SelectedItem;
            int x = 5, y = 10;

            launchPanel.Controls.Clear();
            launchPanel.Controls.AddRange(GetButtons(group, ref x, ref y));
            launchPanel.Update();
        }
コード例 #15
0
ファイル: ControlHelper.cs プロジェクト: Tjlastnumber/TaskDay
 /// <summary>
 /// 控件贴近容器边缘时自动滚动
 /// </summary>
 /// <param name="tabPage">容器</param>
 /// <param name="ctl">当前控件</param>
 private static void BorderScroll(Panel tabPage, Control ctl)
 {
     if (ctl.Top <= 0)
     {
         if ((tabPage.VerticalScroll.Value - tabPage.VerticalScroll.SmallChange) > tabPage.VerticalScroll.Minimum)
         {
             tabPage.VerticalScroll.Value -= tabPage.VerticalScroll.SmallChange;
             tabPage.Update();
         }
     }
     else if (ctl.Bottom >= tabPage.Height)
     {
         if ((tabPage.VerticalScroll.Value + tabPage.VerticalScroll.SmallChange) < tabPage.VerticalScroll.Maximum)
         {
             tabPage.VerticalScroll.Value += tabPage.VerticalScroll.SmallChange;
             tabPage.Update();
         }
     }
 }
コード例 #16
0
ファイル: MainForm.cs プロジェクト: yardenbs/new-facebook
        private void initPanel(Panel pnl)
        {
            pnl.Update();

            if (listBoxClassifiers.SelectedValue != null)
            {
                buttonSentiment.Enabled = true;
            }
            hideAllPanels();
            pnl.Show();
        }
コード例 #17
0
ファイル: Main.cs プロジェクト: Inceptos/localdb-manager
        public void RefreshInstances()
        {
            fillPanel.Controls.Clear();

            foreach (var item in ManageLocalDB.GetInstance)
            {
                Panel panel = new Panel
                {
                    Name = item.Name,
                    Dock = DockStyle.Top,
                    Size = new Size(this.Width, 60)
                };

                Label lb = new Label
                {
                    Text = $"{item.Name} (v{item.LocalDbVersion.ToString(2)})",
                    Dock = DockStyle.Left
                };

                Button delInstance = new Button
                {
                    Text      = "Удалить",
                    Dock      = DockStyle.Right,
                    ForeColor = Color.IndianRed
                };
                delInstance.Click += DelInstance_Click;
                Button startStop = new Button
                {
                    Dock = DockStyle.Right
                };

                if (item.IsRunning)
                {
                    startStop.Text      = "Остановить";
                    startStop.ForeColor = Color.IndianRed;
                    startStop.Click    += StopClick;
                }
                else
                {
                    startStop.Text      = "Запустить";
                    startStop.ForeColor = Color.SeaGreen;
                    startStop.Click    += StartClick;
                }

                panel.Controls.Add(lb);
                panel.Controls.Add(startStop);
                panel.Controls.Add(delInstance);

                fillPanel.Controls.Add(panel);
            }
            fillPanel.Update();
            lbWait.Visible = false;
        }
コード例 #18
0
 public void Update(float delta)
 {
     if (Shown)
     {
         bgPanel.Update(delta);
         boardWidthField.Update(delta);
         boardHeightField.Update(delta);
         bombAmountField.Update(delta);
         seedField.Update(delta);
         cancelBtn.Update(delta);
         acceptBtn.Update(delta);
     }
 }
コード例 #19
0
ファイル: test_chrome.cs プロジェクト: ourstoryzj/mumu
        //绑定chrome
        void bind()
        {
            if (chrome == null)
            {
                chrome = new CefsharpHelper("th://empty");
                if (!Cef.IsInitialized)
                {
                    Random random = new Random();
                    int    temp   = random.Next(1000, 9999);

                    var setting = new CefSharp.WinForms.CefSettings()
                    {
                        //CachePath = Directory.GetCurrentDirectory() + @"\Cache\" + temp.ToString(),
                    };
                    //setting.RegisterScheme(new CefCustomScheme
                    //{
                    //    SchemeName = CefSharpSchemeHandlerFactory.SchemeName,
                    //    SchemeHandlerFactory = new CefSharpSchemeHandlerFactory()
                    //});

                    var ProxyAddress = "58.218.92.65:4442";
                    setting.CachePath = "cache";
                    setting.CefCommandLineArgs.Add("proxy-server", ProxyAddress);
                    // 设置语言
                    //setting.UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53";
                    setting.Locale             = "zh-CN"; // en-US
                    setting.AcceptLanguageList = "zh-CN";
                    Cef.Initialize(setting);
                    //CefSharp.Cef.Initialize(setting, false, new CefsharpHelpers.BrowserProcessHandler());
                }

                var browser = chrome.CreateBrowser();
                //this.Invoke(new Action<Panel>(p =>
                //{
                //    p.Controls.Add(browser);
                //    p.Update();
                //}), this.panel1);
                Panel pan = new Panel();

                pan.Dock = DockStyle.Fill;
                panel1.Controls.Add(pan);
                panel1.Update();
                pan.Controls.Add(browser);
                pan.Update();


                //添加右键

                browser.MenuHandler = new  ContextMenuHandler();
            }
        }
コード例 #20
0
        public override void Update(GameTime gameTime, bool isInForeground)
        {
            base.Update(gameTime, isInForeground);

            if (!isInForeground)
            {
                return;
            }

            panel.Update(gameTime);

            if (addTileButton.IsPressed())
            {
                if (!String.IsNullOrWhiteSpace(tileName.Text))
                {
                    Tile tile = Tile.GetTile(tileType.List[tileType.CurrentIndex], Resources.World);
                    Form form = tile.GetEditingForm();
                    currentFormScreen = new FormScreen(Manager, form, Resources.World);
                    currentTile       = tile;
                    Manager.OpenScreen(currentFormScreen);
                    return;
                }
            }
            if (currentFormScreen != null && currentFormScreen.IsSubmitted && currentTile != null)
            {
                if (currentTile is LocatedTile)
                {
                    currentTile.SubmitForm(currentFormScreen.Form);
                    currentFormScreen = null;
                    Manager.CloseScreen();
                }
                else
                {
                    currentTile.SubmitForm(currentFormScreen.Form);
                    if (!Tile.UnLocatedTile.ContainsKey(tileName.Text))
                    {
                        Tile.UnLocatedTile.Add(tileName.Text, currentTile);
                    }
                    currentFormScreen = null;
                    currentTile       = null;
                }
            }

            if (submitButton.IsPressed())
            {
                IsSubmitted = true;
                Manager.CloseScreen();
                return;
            }
        }
コード例 #21
0
ファイル: EIBLine.cs プロジェクト: harpreetoxyent/pnl
        //Redraws all the lines and a part of the background
        private void Redraw(Line line, Point p)
        {
            Graphics.FromImage(baseFrame.BackgroundImage).DrawImage(bmpBack, 0, 0, baseFrame.BackgroundImage.Width,
                                                                    baseFrame.BackgroundImage.Height);
            foreach (Line l in  ((BaseWindow)this.baseFrame.Parent).Lines)
            {
                DrawLine(l);
            }
            Region r = getRegionByLine(line, p);

            //Region r = baseFrame.Region;
            baseFrame.Invalidate(r);
            baseFrame.Update();
        }
コード例 #22
0
        private void BuildModulePanel()
        {
            ModuleViewPanel.Controls.Clear();
            ModuleViewsLayout.Enabled = true;

            foreach (ModuleData Data in ProjectWorker.Proxy.Modules)
            {
                ModuleView NewModuleView = new ModuleView(Data);
                NewModuleView.Dock = DockStyle.Top;

                ModuleViewPanel.Controls.Add(NewModuleView);
                ModuleViewPanel.Update();
            }
        }
コード例 #23
0
ファイル: Vykreslovanie.cs プロジェクト: KatDan/SolarSystem
        public void nastav_polomery()
        {
            int[]      mierka = new int[] { 45, 7, 9, 10, 7, 40, 30, 20, 20 };
            List <int> indexy_viditelne_planety = new List <int>();

            for (int i = 0; i < polomery_pix.Length; i++)
            {
                polomery_pix[i] = mierka[i];
                if (sustava.objekty[i].viditelnost == true)
                {
                    indexy_viditelne_planety.Add(i);
                }
            }
            if (indexy_viditelne_planety.Count >= 2)
            {
                double a   = pozicie_pix_vykr[indexy_viditelne_planety[1]].x - pozicie_pix_vykr[indexy_viditelne_planety[0]].x;
                double b   = a * Math.Sqrt(1 - Math.Pow(sustava.objekty[indexy_viditelne_planety[1]].excentricita, 2));
                double pom = 2 * mierka[indexy_viditelne_planety[0]] + mierka[indexy_viditelne_planety[1]] + 30;
                double k   = b / pom;

                for (int i = 0; i < polomery_pix.Length; i++)
                {
                    polomery_pix[i] = (int)(polomery_pix[i] * k);
                    if (polomery_pix[i] == 0)
                    {
                        polomery_pix[i] = 1;
                    }

                    Console.WriteLine("polomer : " + polomery_pix[i] * (int)k);
                    telesa[i].Size = new Size((int)(2 * polomery_pix[i]), (int)(2 * polomery_pix[i]));
                    telesa[i].BringToFront();
                }
                updateni_pozicie();
                panel.Update();
            }
        }
コード例 #24
0
        private void panel_MouseClick(object sender, MouseEventArgs e)
        {
            Panel p = sender as Panel;
            Color c = ChooseColor(p.BackColor);

            if (c == Color.Empty)
            {
                return;
            }

            p.BackColor = c;
            p.Update();

            calc();
        }
コード例 #25
0
ファイル: Vesmir.cs プロジェクト: KatDan/SolarSystem
 public void mode_Click(object sender, EventArgs e)
 {
     if(mode.Text == "Mode: Heliocentric")
     {
         //kresli.geo();
         sustava.mod = false;
         mode.Text = "Mode: Geocentric";
         //kresli.telesa[1].X -= 500;
         plocha.Update();
     }
     else
     {
         sustava.mod = true;
         //kresli.helio();
         mode.Text = "Mode: Heliocentric";
     }
     reset.PerformClick();
 }
コード例 #26
0
    public override bool Update()
    {
        if (!IsVisible)
        {
            return(false);
        }
        bool handled = false;

        if (!handled)
        {
            handled = content.Update();
        }
        if (!handled)
        {
            handled = close.Update();
        }
        return(base.Update());
    }
コード例 #27
0
ファイル: BipImageList.cs プロジェクト: Jackjet/BIP
        void picPanel_MouseWheel(object sender, MouseEventArgs e)
        {
            if (picPanel.VerticalScroll.Visible)
            {
                int scrollValue = -e.Delta / 12;
                if (scrollValue > 0)
                {
                    picPanel.VerticalScroll.Value = (picPanel.VerticalScroll.Value + scrollValue) > picPanel.VerticalScroll.Maximum ? picPanel.VerticalScroll.Maximum : (picPanel.VerticalScroll.Value + scrollValue);
                }
                else
                {
                    picPanel.VerticalScroll.Value = (picPanel.VerticalScroll.Value + scrollValue) < picPanel.VerticalScroll.Minimum ? picPanel.VerticalScroll.Minimum : (picPanel.VerticalScroll.Value + scrollValue);
                }

                picPanel.Refresh();
                picPanel.Invalidate();
                picPanel.Update();
            }
        }
コード例 #28
0
        public override void Update(GameTime gameTime, bool isInForeground)
        {
            base.Update(gameTime, isInForeground);

            if (!isInForeground)
            {
                return;
            }

            panel.Update(gameTime);

            if (lastElementSelected != tree.SelectedElement && tree.SelectedElement.IsFile)
            {
                textureDrawer.Texture = Manager.Game.Content.Load <Texture2D>(tree.SelectedElement.Path.Substring(8));
            }

            if (submitButton.IsPressed())
            {
                IsSubmitted = true;
                Manager.CloseScreen();
            }

            if (addSpriteButton.IsPressed() && textureDrawer.SelectedRectangle != null && textureDrawer.SelectedPoint != null)
            {
                SpriteSheet sheet = Resources.GetSpriteSheet(tree.SelectedElement.Path.Split('/', '\\').Last());
                if (!Resources.SpriteSheets.ContainsKey(tree.SelectedElement.Path.Split('/', '\\').Last()))
                {
                    sheet = new SpriteSheet(Manager.Game, tree.SelectedElement.Path.Substring(8));
                    Resources.Add(tree.SelectedElement.Path.Split('/', '\\').Last(), sheet);
                }
                Rectangle r      = textureDrawer.SelectedRectangle.Value;
                Point     origin = new Point((int)textureDrawer.SelectedPoint.Value.X - r.Location.X, (int)textureDrawer.SelectedPoint.Value.Y - r.Location.Y);
                Resources.Add(addSpriteText.Text, new Sprite(sheet, (Rectangle)textureDrawer.SelectedRectangle, origin, Resources));
            }

            Vector2 vec = textureDrawer.ConvertScreenToPicture(new Vector2(Input.X, Input.Y));

            coordinate.Text = "X : " + vec.X + " / Y : " + vec.Y;

            lastElementSelected = tree.SelectedElement;
        }
コード例 #29
0
        /// <summary>
        /// Update the UI manager. This function should be called from your Game 'Update()' function, as early as possible (eg before you update your game state).
        /// </summary>
        /// <param name="gameTime">Current game time.</param>
        static public void Update(GameTime gameTime)
        {
            // update input manager
            _input.Update(gameTime);

            // update root panel
            Entity dragTarget      = null;
            Entity target          = null;
            bool   wasEventHandled = false;

            _root.Update(_input, ref target, ref dragTarget, ref wasEventHandled);

            // set active entity
            if (_input.MouseButtonDown(MouseButton.Left))
            {
                ActiveEntity = target;
            }

            // default active entity is root panel
            ActiveEntity = ActiveEntity ?? _root;
        }
コード例 #30
0
ファイル: SortWithPaint.cs プロジェクト: temkarus0070/kg
        public void InsertSort(ArrayElement[] array, Panel panel, int speed)
        {
            for (int i = 1; i < array.Length; i++)
            {
                panel.Update();
                var element = array[i];

                DownAnimation(array, i, panel);

                Thread.Sleep(speed * 1000);
                int j = i - 1;
                while (j >= 0 && array[j].Value > element.Value)
                {
                    SelectElement(array, j, panel);
                    SelectElement(array, j + 1, panel);
                    Thread.Sleep(speed * 1000);
                    var e = new ArrayElement(array[j].Value, new  Point(array[j].Location.X, array[j].Location.Y));
                    e.Color               = Color.White;
                    array[j + 1]          = array[j];
                    array[j + 1].Location = points[j + 1];
                    array[j]              = e;
                    array[j + 1].Color    = Color.White;

                    array[j].Color = Color.White;
                    j--;
                    Thread.Sleep(speed * 1000);
                    Point pointForElement = new Point(points[j + 1].X, points[j + 1].Y + 60);

                    FinalTaskForm.selectedElement       = new ArrayElement(element.Value, pointForElement);
                    FinalTaskForm.selectedElement.Color = Color.White;
                    panel.Invalidate();
                }
                array[j + 1]          = element;
                array[j + 1].Location = points[j + 1];

                FinalTaskForm.selectedElement = null;
            }
            panel.Invalidate();
        }
コード例 #31
0
ファイル: SuperExplorer.cs プロジェクト: pezipink/FarNet
        ///
        internal void CommitFiles(SuperPanel source, Panel target, IList<FarFile> files, bool move)
        {
            var dicTypeId = GroupFiles(files, ExplorerFunctions.None);

            bool SelectionExists = source.SelectionExists;
            var xfilesToStay = new List<FarFile>();
            bool toUnselect = false;
            bool toUpdate = false;
            foreach (var xTypeId in dicTypeId)
            {
                Log.Source.TraceInformation("AcceptFiles TypeId='{0}'", xTypeId.Key);
                object codata = null;
                foreach (var kv in xTypeId.Value)
                {
                    // explorer and its files
                    var explorer = kv.Key;
                    var xfiles = kv.Value;
                    var filesToAccept = new List<FarFile>(xfiles.Count);
                    foreach (var file in xfiles)
                        filesToAccept.Add(file.File);

                    // accept, mind co-data
                    Log.Source.TraceInformation("AcceptFiles Count='{0}' Location='{1}'", filesToAccept.Count, explorer.Location);
                    var argsAccept = new AcceptFilesEventArgs(ExplorerModes.None, filesToAccept, move, explorer);
                    argsAccept.Data = codata;
                    target.UIAcceptFiles(argsAccept);
                    codata = argsAccept.Data;

                    // info
                    bool isIncomplete = argsAccept.Result == JobResult.Incomplete;
                    bool isAllToStay = isIncomplete && argsAccept.FilesToStay.Count == 0;

                    // Copy: do not update the source, files are the same
                    if (!move)
                    {
                        // keep it as it is
                        if (isAllToStay || !SelectionExists)
                        {
                            if (isAllToStay && SelectionExists)
                                foreach(var file in xfiles)
                                    xfilesToStay.Add(file);
                            continue;
                        }

                        // drop selection
                        toUnselect = true;

                        // recover
                        if (isIncomplete)
                            xfilesToStay.AddRange(SuperFile.SuperFilesOfExplorerFiles(xfiles, argsAccept.FilesToStay, explorer.FileComparer));

                        continue;
                    }

                    // Move: no need to delete or all to stay or cannot delete
                    if (!argsAccept.ToDeleteFiles || isAllToStay || !explorer.CanDeleteFiles)
                    {
                        // the source may have some files deleted, update
                        toUpdate = true;

                        // recover selection
                        if (isIncomplete)
                            xfilesToStay.AddRange(SuperFile.SuperFilesOfExplorerFiles(
                                xfiles, isAllToStay ? argsAccept.Files : argsAccept.FilesToStay, explorer.FileComparer));

                        continue;
                    }

                    // Move: delete is requested, delete the source files

                    // exclude this files to stay from to be deleted
                    if (isIncomplete)
                    {
                        foreach (SuperFile xfile in SuperFile.SuperFilesOfExplorerFiles(xfiles, argsAccept.FilesToStay, explorer.FileComparer))
                        {
                            xfiles.Remove(xfile);
                            xfilesToStay.Add(xfile);
                        }
                    }

                    // call delete on remaining files
                    object codata2 = null;
                    var result = DeleteFilesOfExplorer(explorer, xfiles, xfilesToStay, ExplorerModes.Silent, false, ref codata2);
                    if (result == JobResult.Done || result == JobResult.Incomplete)
                        toUpdate = true;
                }
            }

            // update the target panel
            target.Update(true);
            target.Redraw();

            // update/recover the source

            if (toUpdate)
                source.Update(false);
            else if (toUnselect)
                source.UnselectAll();

            if (xfilesToStay.Count > 0)
                source.SelectFiles(xfilesToStay, null);

            source.Redraw();
        }