Ejemplo n.º 1
0
        private void pnPoupup_MouseMove(object sender, MouseEventArgs e)
        {
            if (ismove)
            {
                this.BackColor       = Color.Gainsboro;
                this.TransparencyKey = Color.Gainsboro;

                pnPoupup.Location = new Point(pnPoupup.Location.X - (x - e.X), pnPoupup.Location.Y - (y - e.Y));
                int pnx = pnPoupup.Location.X;
                int pny = pnPoupup.Location.Y;
                if (checkInZoneClosed(pnx, pny))
                {
                    pnClose.BackColor = Color.IndianRed;
                }
                else
                {
                    pnClose.BackColor = Color.White;
                }
                ismoveControls();
                isfirsMove = true;
                isMoveTrue = true;

                Aero.EnableAcrylic(blureForm.frmBlueGone, Color.Transparent);
            }
        }
Ejemplo n.º 2
0
        private static readonly Rgb white = new Rgb(60, 255, 90);         // white point.

        public static async Task Main()
        {
            using (Aero aero = new Aero())
            {
                Ite829XRgbController rgb = (Ite829XRgbController)aero.Keyboard.Rgb;
                byte[] image             = new byte[512];

                double hStart = 0.0;
                for (;;)
                {
                    double h = hStart;
                    for (int i = 0; i < 128; ++i)
                    {
                        Rgb color = HsvToRgb(h, 1.0, 1.0);
                        image[4 * i + 0] = (byte)i;
                        image[4 * i + 1] = (byte)(color.R * white.R / 255);
                        image[4 * i + 2] = (byte)(color.G * white.G / 255);
                        image[4 * i + 3] = (byte)(color.B * white.B / 255);
                        h += 2.0;
                    }

                    await rgb.SetImageAsync(0, image);

                    hStart += 20.0;
                }
            }
        }
Ejemplo n.º 3
0
    void Update()
    {
        Aero air = FindObjectOfType <Aero>();

        if (air != null)
        {
            if (WindX.gameObject.active == false)
            {
                WindX.gameObject.active = WindY.gameObject.active = WindZ.gameObject.active = true;
            }

            air.WindVelocity.x = WindX.value;
            air.WindVelocity.y = WindY.value;
            air.WindVelocity.z = WindZ.value;
        }

        CreateCloth sp = FindObjectOfType <CreateCloth>();

        if (sp != null)
        {
            sp.b = DampingForce.value;
            sp.k = SpringConst.value;
        }

        else
        {
            WindX.gameObject.active = WindY.gameObject.active = WindZ.gameObject.active = false;
        }
    }
Ejemplo n.º 4
0
        private void btn_embarque_Click(object sender, EventArgs e)
        {
            if (cmb_voos.Text == "")
            {
                MessageBox.Show("Preecha todos os campos!", "AVISO!!!");
                return;
            }

            if (cmb_voos.SelectedItem != null && cmb_voos.SelectedItem is Voo)
            {
                if (((Voo)cmb_voos.SelectedItem).getAssentos() <= 0)
                {
                    ((Voo)cmb_voos.SelectedItem).getPassengerQueue().Enqueue(Passenger);
                }
                else
                {
                    ((Voo)cmb_voos.SelectedItem).addPassenger(Passenger);
                }

                Passenger.setEmbarque(((Voo)cmb_voos.SelectedItem).getNumero());

                Aero.pUser.Remove(Passenger);

                Aero.SyncListBox(Aero.lbx_fila, 0);

                MessageBox.Show("Passageiro: [" + Passenger.getNome() + "] foi embarcado no Voo: [" + ((Voo)cmb_voos.SelectedItem).getNome() + "] de Numero: [" + ((Voo)cmb_voos.SelectedItem).getNumero() + "] !!!");
            }

            this.Close();
            ShowPassageiro.Close();
        }
Ejemplo n.º 5
0
        private void btn_criar_Click(object sender, EventArgs e)
        {
            if (txtb_nome.Text == "" || txtb_origem.Text == "" || txtb_destino.Text == "" || txtb_num.Text == "" || cmb_capc.Text == "")
            {
                MessageBox.Show("Preecha todos os campos!", "AVISO!!!");
                return;
            }

            Voo vv = new Voo();

            vv.setNome(txtb_nome.Text);
            vv.setDestino(txtb_destino.Text);
            vv.setOrigem(txtb_origem.Text);
            vv.setNumero(Convert.ToInt32(txtb_num.Text));
            vv.setCapacidade(Convert.ToInt32(cmb_capc.Text));
            vv.setAssentos(Convert.ToInt32(cmb_capc.Text));

            foreach (var item in Aero.pVoo.Keys)
            {
                if (item == vv.getNumero())
                {
                    MessageBox.Show("Voo já cadastrado!", "AVISO!!!");
                    Clear();
                    return;
                }
            }

            MessageBox.Show("Voo do Nome: [" + vv.getNome() + "] de Numero: [" + vv.getNumero() + "] criado com sucesso!");
            Aero.pVoo.Add(vv.getNumero(), vv);
            Aero.SyncListBox(Aero.lbx_voos, 1);
            this.Close();
        }
Ejemplo n.º 6
0
		/// <summary>
		/// Aero效果设置已改变
		/// </summary>
		private void WindowBase_AeroGlassCompositionChanged(object sender, Aero.AeroGlassCompositionChangedEventArgs e)
		{
			if (e.GlassAvailable)
			{
				Aero.AeroHelper.EnableBlurBehindWindow(this);
			}
		}
Ejemplo n.º 7
0
 void SizerMouseUp(object sender, MouseEventArgs e)
 {
     Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
         GradientColor = 0xFD70000, AccentState = FormAccent
     });
     Opacity = 1.0;
     mov     = false;
 }
Ejemplo n.º 8
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            //cropElipPanel();
            checkIntStyleWinform();
            //Properties.Settings.Default.Reset();
            SaveSettingForm.IntializeForm(this);

            blureForm.SetLocations = this.Location;
            blureForm.SetSize      = this.Size;
            blureForm.Intialization();
            Aero.EnableAcrylic(blureForm.frmBlueGone, Color.Transparent);

            //pnAutoPIP.BackgroundImage = (Properties.Settings.Default.FAutoPIP) ? Properties.Resources.done_red : Properties.Resources.done;
            if (Properties.Settings.Default.FAutoPIP)
            {
                pnAutoPIP.BackgroundImage = Properties.Resources.done_red;
                pnDF.BackColor            = Color.IndianRed;
            }
            else
            {
                pnAutoPIP.BackgroundImage = Properties.Resources.done;
                pnDF.BackColor            = Color.MediumSeaGreen;
            }

            toolTipText();

            Library.is_openedwindows = true;

            this.TopMost = Properties.Settings.Default.FIsShowTop;

            frmShow();

            if (!is_showicontray)
            {
                is_showicontray = true;
                frmIconTray frmicon = new frmIconTray();
                frmicon.Show();
            }

            Thread thload = new Thread(new ThreadStart((() =>
            {
                if (this.InvokeRequired)
                {
                    this.BeginInvoke((MethodInvoker) delegate()
                    {
                        load();
                    });
                }
                else
                {
                    load();
                }
            })));

            thload.Start();
        }
Ejemplo n.º 9
0
 private void Drag_MouseUp(object sender, MouseEventArgs e)
 {
     mouseDown = false;
     if (Drag)
     {
         Control cntrl = (Control)sender;
         Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
             GradientColor = 0xFD70000, AccentState = FormAccent
         });
         this.Opacity = 1;
         cntrl.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 10
0
 private void Drag_MouseDown(object sender, MouseEventArgs e)
 {
     mouseDown    = true;
     lastLocation = e.Location;
     if (Drag)
     {
         Control cntrl = (Control)sender;
         Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
             GradientColor = 0xFD70000, AccentState = Enums.AccentState.ACCENT_DISABLED
         });
         this.Opacity = 0.85;
         cntrl.Cursor = Cursors.Hand;
     }
 }
Ejemplo n.º 11
0
        static async Task Main(string[] args)
        {
            bool run = true;

            Console.CancelKeyPress += (s, e) =>
            {
                e.Cancel = true;
                run      = false;
            };

            var computer = new Computer
            {
                IsCpuEnabled = true,
                IsGpuEnabled = true
            };

            computer.Open();

            var cpu = computer.Hardware.First(hw => hw.HardwareType == HardwareType.Cpu);

            cpu.Update();

            foreach (var sens in cpu.Sensors.Where(s => s.SensorType == SensorType.Temperature))
            {
                Console.WriteLine($"{sens.Name} = {sens.Value}");
            }

            computer.Close();

            using (HwMonitor hw = new HwMonitor())
                using (Aero aero = new Aero())
                {
                    //Random rng = new Random();
                    //IDirectFanSpeedController fans = (IDirectFanSpeedController)aero.Fans;

                    while (run)
                    {
                        hw.Update();
                        double wmiCpuTemp = await aero.Cpu.GetTemperatureAsync();

                        double monCpuTemp = hw.CpuTemperature;
                        double monGpuTemp = hw.GpuTemperature;
                        Console.Write($"CPU {wmiCpuTemp:F1}°C \t {monCpuTemp:F1}°C \t GPU {monGpuTemp:F1}°C   ");
                        Console.CursorLeft = 0;
                        //fans.SetFixed(0.0 + rng.NextDouble() * 0.3);
                        await Task.Delay(500);
                    }
                }
        }
        private void btn_desembarcar_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Tem certeza que deseja desembarcar?", "AVISO!!!", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (Passenger.getEmbarque() != 0)
                {
                    foreach (var item in Aero.pVoo.Keys)
                    {
                        if (Passenger.getEmbarque() == item)
                        {
                            Passenger.setEmbarque(0);
                            Aero.pUser.Add(Passenger);

                            bool Success = Aero.pVoo[item].removePassengerQueue(Passenger);

                            if (Success == false)
                            {
                                Aero.pVoo[item].removePassenger(Passenger);

                                if (Aero.pVoo[item].getPassengerQueue().Count > 0 && Aero.pVoo[item].getAssentos() > 0)
                                {
                                    Aero.pVoo[item].addPassenger(Aero.pVoo[item].getPassengerQueue().Dequeue());
                                }
                            }

                            Aero.SyncListBox(Aero.lbx_fila, 0);

                            Aero.lbx_voos_lista.DataSource = null;
                            Aero.lbx_voos_lista.DataSource = Aero.pVoo[item].getPassengerList();
                            Aero.lbx_voos_lista.Refresh();
                            Aero.lbx_voos_lista.Update();

                            Aero.lbx_voos_fila.DataSource = null;
                            Aero.lbx_voos_fila.DataSource = Aero.pVoo[item].getPassengerQueue().ToList();
                            Aero.lbx_voos_fila.Refresh();
                            Aero.lbx_voos_fila.Update();

                            MessageBox.Show("Passageiro: [" + Passenger.getNome() + "] desembarcou do Voo: [" + Aero.pVoo[item].getNome() + "] de Numero: [" + Aero.pVoo[item].getNumero() + "] !!!");
                            RefreshAssentos(Aero.form_showvoo, Aero.pVoo[item].getAssentos());
                            this.Close();
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Create aero and controller.
            this.aero       = new Aero();
            this.controller = new AeroController(this.aero);
            this.controller.Load();

            // Create background update task.
            this.updateTask = this.Dispatcher.InvokeAsync(() => this.updateLoop(this.cancellationTokenSource.Token), DispatcherPriority.Background).Task;

            // Get app icon.
            Icon ico;

            using (Stream stream = typeof(App).Assembly.GetManifestResourceStream("AeroCtl.UI.Main.ico"))
            {
                ico = new Icon(stream);
            }

            // Create tray icon.
            this.trayIcon = new NotifyIcon
            {
                Icon    = ico,
                Text    = this.title,
                Visible = true,
            };

            this.trayIcon.DoubleClick += (s, e2) => { this.showWindow(); };

            // Handle Fn key events.
            this.aero.Keyboard.FnKeyPressed   += (s, e2) => { this.Dispatcher.InvokeAsync(() => this.handleFnKey(e2)); };
            this.aero.Touchpad.EnabledChanged += (s, e2) => { this.Dispatcher.InvokeAsync(() => this.onTouchpadEnabledChanged().AsTask()); };

            // To re-apply fan profile after wake up:
            SystemEvents.SessionSwitch    += this.onSessionSwitch;
            SystemEvents.PowerModeChanged += this.onPowerModeChanged;

            if (!this.controller.StartMinimized || Debugger.IsAttached)
            {
                // Show window if 'start minimized' isn't active.
                this.showWindow();
            }
        }
Ejemplo n.º 14
0
        public static void SetConsoleAsTransparent(bool setOnParentProc = false)
        {
            if (!IsAeroGlassEnabled())
            {
                return;
            }
            var myproc = System.Diagnostics.Process.GetCurrentProcess();

            if (setOnParentProc)
            {
                myproc = GetParentProcessById(myproc.Id);
            }
            var hwnd   = myproc.MainWindowHandle;
            var margin = new Aero.MARGINS {
                top = -1, left = -1
            };

            Aero.DwmExtendFrameIntoClientArea(hwnd, ref margin);
        }
Ejemplo n.º 15
0
        private void ismoveControls()
        {
            if (ismove)
            {
                if (!isfirsMove)
                {
                    blureForm.SetSize      = this.Size;
                    blureForm.SetLocations = this.Location;
                    blureForm.Intialization();
                    //blureForm.frmBlueGone.Hide();
                    this.Focus();

                    pnClose.Show();
                    this.Focus();
                    BlueformFrameworkUse.FormNormal(blureForm.frmBlueGone, 15);
                }
            }
            else
            {
                pnClose.Visible = false;
                BlueformFrameworkUse.FormBlure(blureForm.frmBlueGone, 10);
                tmwait.Stop();
                tmwait          = new System.Windows.Forms.Timer();
                tmwait.Interval = 170;
                tmwait.Tick    += new EventHandler((object obj, EventArgs e) =>
                {
                    tmwait.Stop();

                    Aero.DisabledAcrylic(blureForm.frmBlueGone);
                    blureForm.DisponseForm();
                    GC.Collect();
                    GC.WaitForPendingFinalizers();

                    if (isClosetForm)
                    {
                        Show_Close(false);
                    }
                });
                tmwait.Start();
            }
        }
Ejemplo n.º 16
0
    void Update()
    {
        Aero.CalAero(ref objectNodes, amount);

        /*
         * {
         *
         * List<Spring> springs = new List<Spring>();
         * // Use this for initialization
         * void Start ()
         * {
         * springs.AddRange(FindObjectsOfType<Spring>());
         *
         * }
         *
         * // Update is called once per frame
         * void Update()
         * {
         * foreach (Spring s in FindObjectOfType<Spring>())
         * {
         *  s.DampingFactor = b;
         *  s.SpringConstant = k;
         *  s.breakLength = breakLength;
         * }
         * }
         * public float k;
         * public float b;
         * public float breakLength;
         *
         *
         */
        foreach (GameObject s in springs)
        {
            if (s != null)
            {
                s.GetComponent <Spring>().DampingFactor  = b;
                s.GetComponent <Spring>().SpringConstant = k;
                s.GetComponent <Spring>().breakLength    = breakLength;
            }
        }
    }
Ejemplo n.º 17
0
 void SizerMouseMove(object sender, MouseEventArgs e)
 {
     pbResize.Cursor = Resizer ? Cursors.SizeNWSE : Cursors.Default;
     if (mov && Resizer)
     {
         Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
             GradientColor = 0xFD70000, AccentState = Enums.AccentState.ACCENT_DISABLED
         });
         this.Opacity = 0.85;
         int t_width  = MousePosition.X - Mx + Sw;
         int t_height = MousePosition.Y - My + Sh;
         if (t_width >= MinWidth)
         {
             Width = t_width;
         }
         if (t_height >= MinHeight)
         {
             Height = t_height;
         }
     }
 }
Ejemplo n.º 18
0
        private void btn_criar_Click(object sender, EventArgs e)
        {
            if (txtb_nome.Text == "" || txtb_cpf.Text == "" || txtb_datnasc.Text == "" || txtb_end.Text == "" ||
                cmb_idade.Text == "" || cmb_estcivil.Text == "" || txtb_rg.Text == "" ||
                (rbtn_fem.Checked == false && rbtn_masc.Checked == false))
            {
                MessageBox.Show("Preecha todos os campos!", "AVISO!!!");
                return;
            }

            if (txtb_cpf.Text.Length != 11)
            {
                MessageBox.Show("Preecha o CPF corretamente!", "AVISO!!!");
                return;
            }

            if (txtb_rg.Text.Length != 9)
            {
                MessageBox.Show("Preecha o RG corretamente!", "AVISO!!!");
                return;
            }

            if (txtb_datnasc.Text.Length != 8)
            {
                MessageBox.Show("Preecha a Data de Nascimento corretamente!", "AVISO!!!");
                return;
            }

            Passageiro Psg = new Passageiro();

            Psg.setNome(txtb_nome.Text);
            Psg.setCPF(txtb_cpf.Text);
            Psg.setDataNascimento(txtb_datnasc.Text);
            Psg.setEndereco(txtb_end.Text);
            Psg.setIdade(Convert.ToInt32(cmb_idade.Text));
            Psg.setEstadoCivil(cmb_estcivil.Text);
            Psg.setRG(txtb_rg.Text = txtb_rg.Text.ToUpper());
            Psg.setEmbarque(0);

            if (rbtn_fem.Checked == true)
            {
                Psg.setSexo("Feminino");
            }
            else if (rbtn_masc.Checked == true)
            {
                Psg.setSexo("Masculino");
            }

            foreach (var item in Aero.pUser)
            {
                if (Psg.Equals(item))
                {
                    MessageBox.Show("Usuario já cadastrado!", "AVISO!!!");
                    Clear();
                    return;
                }
            }

            Aero.pUser.Add(Psg);

            Aero.SyncListBox(Aero.lbx_fila, 0);

            MessageBox.Show("Passageiro do Nome: [" + Psg.getNome() + "] e Idade: [" + Psg.getIdade() + "] criado com sucesso!");
            this.Close();
        }
Ejemplo n.º 19
0
        public static async Task Main(string[] args)
        {
            using (Aero aero = new Aero())
            {
                IRgbController rgb = aero.Keyboard.Rgb;

                byte r = 40;
                byte g = 255;
                byte b = 90;
                bool showOriginalWhite = false;

                byte[] image = new byte[512];

                for (;;)
                {
                    for (int i = 0; i < 128; ++i)
                    {
                        image[4 * i + 0] = (byte)i;
                        image[4 * i + 1] = r;
                        image[4 * i + 2] = g;
                        image[4 * i + 3] = b;
                    }


                    if (showOriginalWhite)
                    {
                        Console.WriteLine("white");
                        await rgb.SetEffectAsync(new RgbEffect { Type = RgbEffectType.Static, Color = RgbEffectColor.White, Brightness = 51 });
                    }
                    else
                    {
                        Console.WriteLine($"{r}, {g}, {b}");
                        await rgb.SetEffectAsync(new RgbEffect { Type = RgbEffectType.Custom0, Brightness = 51 });

                        await rgb.SetImageAsync(0, image);
                    }

                    await Task.Delay(50);

                    switch (Console.ReadKey(true).KeyChar)
                    {
                    case ' ':
                        showOriginalWhite = !showOriginalWhite;
                        break;

                    case 'r':
                        --r;
                        break;

                    case 'R':
                        ++r;
                        break;

                    case 'g':
                        --g;
                        break;

                    case 'G':
                        ++g;
                        break;


                    case 'b':
                        --b;
                        break;

                    case 'B':
                        ++b;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            if (Debugger.IsAttached)
            {
                return;
            }
            for (int i = 0; i < args.Length; i++)
            {
                args[i] = args[i].ToLower();
            }

            //Console.Title = "Bluepill";

            BluepillProgressInterface progress = new Aero();

            if (args == null || args.Length == 0 || string.IsNullOrEmpty(args[0]))
            {
                var res = Dialogs.ShowChoiceDialog();

                switch (res)
                {
                case Dialogs.Choices.Install:
                {
                    args = new string[1] {
                        "install"
                    };
                    break;
                }

                case Dialogs.Choices.Uninstall:
                {
                    args = new string[1] {
                        "uninstall"
                    };
                    break;
                }

                default:
                {
                    return;
                }
                }
            }

            switch (args[0].ToLower())
            {
            case "install":
            {
                new BluepillProgress((object sender, DoWorkEventArgs e) =>
                    {
                        new BPMain(progress).Install();
                    }, progress);
                break;
            }

            case "uninstall":
            {
                new BluepillProgress((object sender, DoWorkEventArgs e) =>
                    {
                        new BPMain(progress).Uninstall();
                    }, progress);
                break;
            }

            default:
            {
                ShowHelp();
                break;
            }
            }
        }
Ejemplo n.º 21
0
    static public void CalAero(ref Dictionary <Vector2, GameObject> nodes, float amount)
    {
        Aero aeroObject = FindObjectOfType <Aero>();

        if (aeroObject != null && aeroObject.GetComponent <Aero>().WindVelocity != Vector3.zero)
        {
            for (int row = 0; row < amount; row++)
            {
                for (int colom = 0; colom < amount; colom++)
                {
                    if (nodes.ContainsKey(new Vector2(row + 1, colom)) && nodes.ContainsKey(new Vector2(row + 1, colom + 1)))
                    {
                        GameObject p1 = nodes[new Vector2(row, colom)];
                        GameObject p2 = nodes[new Vector2(row + 1, colom)];
                        GameObject p3 = nodes[new Vector2(row + 1, colom + 1)];
                        if (p1 != null && p2 != null && p3 != null)
                        {
                            Vector3 Vsurface = (p1.GetComponent <Node>().vel + p2.GetComponent <Node>().vel + p3.GetComponent <Node>().vel) / 3;

                            Vector3 V = Vsurface - aeroObject.WindVelocity;

                            Vector3 crossProduct = Vector3.Cross(p2.transform.position - p1.transform.position, p3.transform.position - p1.transform.position);
                            Vector3 N            = crossProduct / Vector3.Magnitude(crossProduct);

                            float ao = .5f * Vector3.Magnitude(crossProduct);
                            float a  = ao * Vector3.Dot(V, N) / Vector3.Magnitude(V);

                            Vector3 faero = -.5f * (aeroObject.p * (Vector3.Magnitude(V) * Vector3.Magnitude(V)) * aeroObject.cdrag * a) * N;

                            p1.GetComponent <Node>().frc = p2.GetComponent <Node>().airfrc = p3.GetComponent <Node>().frc = faero / 3;
                        }
                    }
                }
            }
            for (int row = 0; row < amount; row++)
            {
                for (int colom = 0; colom < amount; colom++)
                {
                    if (nodes.ContainsKey(new Vector2(row, colom + 1)) && nodes.ContainsKey(new Vector2(row + 1, colom + 1)))
                    {
                        GameObject p1 = nodes[new Vector2(row, colom)];
                        GameObject p2 = nodes[new Vector2(row, colom + 1)];
                        GameObject p3 = nodes[new Vector2(row + 1, colom + 1)];
                        if (p1 != null && p2 != null && p3 != null)
                        {
                            Vector3 Vsurface = (p1.GetComponent <Node>().vel + p2.GetComponent <Node>().vel + p3.GetComponent <Node>().vel) / 3;

                            Vector3 V = Vsurface - aeroObject.WindVelocity;

                            Vector3 crossProduct = Vector3.Cross(p2.transform.position - p1.transform.position, p3.transform.position - p1.transform.position);
                            Vector3 N            = crossProduct / Vector3.Magnitude(crossProduct);

                            float ao = .5f * Vector3.Magnitude(crossProduct);
                            float a  = ao * Vector3.Dot(V, N) / Vector3.Magnitude(V);



                            Vector3 faero = -.5f * (aeroObject.p * (Vector3.Magnitude(V) * Vector3.Magnitude(V)) * aeroObject.cdrag * a) * N;

                            p1.GetComponent <Node>().frc = p2.GetComponent <Node>().airfrc = p3.GetComponent <Node>().frc = faero / 3;
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 22
0
 public void endAero()
 {
     Aero.DisabledAcrylic(blureForm.frmBlueGone);
     blureForm.DisponseForm();
 }
Ejemplo n.º 23
0
        private void WinForm_Load(object sender, EventArgs e)
        {
            this.Resize += new EventHandler(WinForm_Resize);

            #region Top Panel
            pnlTop.Size   = new Size(560, 30);
            pnlTop.Dock   = DockStyle.Top;
            pnlTop.Paint += new PaintEventHandler(pnlTop_Paint);
            AddDrag(pnlTop);
            //this.Controls.Add(pnlTop);
            #endregion

            #region Minimaze Button
            btnMinimaze.ForeColor = ForeColor;
            btnMinimaze.BackColor = pnlTop.BackColor;
            btnMinimaze.FlatStyle = FlatStyle.Flat;
            btnMinimaze.FlatAppearance.BorderSize         = 0;
            btnMinimaze.FlatAppearance.MouseDownBackColor = Color.FromArgb(44, 44, 44);
            btnMinimaze.FlatAppearance.MouseOverBackColor = Color.FromArgb(66, 66, 66);
            btnMinimaze.Size   = new Size(52, 30);
            btnMinimaze.Dock   = DockStyle.Right;
            btnMinimaze.Cursor = Cursors.Hand;
            btnMinimaze.Font   = new Font("Segoe UI Symbol", 9f);
            btnMinimaze.Text   = "─";
            btnMinimaze.Click += new EventHandler(Minimaze);
            pnlTop.Controls.Add(btnMinimaze);
            #endregion

            #region Maximize Button
            btnMaximize.ForeColor = ForeColor;
            btnMaximize.BackColor = pnlTop.BackColor;
            btnMaximize.FlatStyle = FlatStyle.Flat;
            btnMaximize.FlatAppearance.BorderSize         = 0;
            btnMaximize.FlatAppearance.MouseDownBackColor = Color.FromArgb(44, 44, 44);
            btnMaximize.FlatAppearance.MouseOverBackColor = Color.FromArgb(66, 66, 66);
            btnMaximize.Size   = new Size(52, 30);
            btnMaximize.Dock   = DockStyle.Right;
            btnMaximize.Cursor = Cursors.Hand;
            btnMaximize.Font   = new Font("Segoe UI Symbol", 9f);
            btnMaximize.Text   = "◻";
            btnMaximize.Click += new EventHandler(Maximize);
            pnlTop.Controls.Add(btnMaximize);
            #endregion

            #region Close Button
            btnClose.ForeColor = ForeColor;
            btnClose.BackColor = pnlTop.BackColor;
            btnClose.FlatStyle = FlatStyle.Flat;
            btnClose.FlatAppearance.BorderSize         = 0;
            btnClose.FlatAppearance.MouseDownBackColor = Color.DarkRed;
            btnClose.FlatAppearance.MouseOverBackColor = Color.Red;
            btnClose.Size   = new Size(52, 30);
            btnClose.Dock   = DockStyle.Right;
            btnClose.Cursor = Cursors.Hand;
            btnClose.Font   = new Font("Segoe UI Symbol", 9f);
            btnClose.Text   = "✕";
            btnClose.Click += new EventHandler(Close);
            pnlTop.Controls.Add(btnClose);
            #endregion

            #region Program (Picturebox for Icon)
            pbProgram.SizeMode = PictureBoxSizeMode.Zoom;
            pbProgram.Location = new Point(4, 2);
            pbProgram.Size     = new Size(24, 24);
            pbProgram.Image    = this.Icon.ToBitmap();
            AddDrag(pbProgram);
            pnlTop.Controls.Add(pbProgram);
            #endregion

            //#region Program (Label -> Title)
            //if (this.Icon != null && ShowControlBarIcon)
            //{
            //    lblProgram.Location = new Point(33, 8);
            //}
            //else
            //{
            //    lblProgram.Location = new Point(5, 8);
            //}
            //lblProgram.ForeColor = ForeColor;
            //AddDrag(lblProgram);
            //pnlTop.Controls.Add(lblProgram);
            //#endregion

            #region ResizeGrip (Picturebox)
            pbResize.MouseDown += SizerMouseDown;
            pbResize.MouseMove += SizerMouseMove;
            pbResize.MouseUp   += SizerMouseUp;
            pbResize.Size       = new Size(ResizeGripSize, ResizeGripSize);
            pbResize.BackColor  = Color.Transparent;
            pbResize.Location   = new Point(this.Width - pbResize.Size.Width, this.Height - pbResize.Size.Height);
            //pbResize.Cursor = Cursors.SizeNWSE;
            this.Controls.Add(pbResize);
            pbResize.BringToFront();
            #endregion

            #region Extra
            Aero.ChangeAccent(Handle, new Enums.AccentPolicy {
                GradientColor = 0xFD70000, AccentState = FormAccent
            });
            if (ExtraDropShadow)
            {
                Shadow.AddShadow(Handle);
            }
            #endregion
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Update state and apply.
        /// </summary>
        /// <returns></returns>
        public static async Task <bool> UpdateAsync()
        {
            await Task.Delay(5);             // Small delay so Control.IsKeyLocked returns the correct value.

            // Sometimes the keyboard controller seems to get disconnected (e.g. after wake up from sleep), so we try a couple of times.
            for (int i = 9; i >= 0; --i)
            {
                using (Aero aero = new Aero())
                {
                    // Read current keyboard state.
                    EffectState state = 0;

                    if (Control.IsKeyLocked(Keys.CapsLock))
                    {
                        state |= EffectState.Caps;
                    }
                    else
                    {
                        state &= ~EffectState.Caps;
                    }

                    if (Control.IsKeyLocked(Keys.NumLock))
                    {
                        state |= EffectState.Num;
                    }
                    else
                    {
                        state &= ~EffectState.Num;
                    }

                    if (Control.IsKeyLocked(Keys.Scroll))
                    {
                        state |= EffectState.Scroll;
                    }
                    else
                    {
                        state &= ~EffectState.Scroll;
                    }

                    if (await aero.Display.GetLidStatus() == LidStatus.Closed)
                    {
                        state |= EffectState.LidClosed;
                    }
                    else
                    {
                        state &= ~EffectState.LidClosed;
                    }

                    //Console.WriteLine(state);

                    // Try to apply the effect.
                    if (await applyAsync(aero.Keyboard.Rgb, state, i > 0))
                    {
                        return(true);
                    }
                }

                await Task.Delay(1000);
            }

            return(false);
        }