Exemplo n.º 1
0
 private void QlibToolbar_MouseDown(object sender, MouseEventArgs e)
 {
     if (dragForm && e.Button == MouseButtons.Left)
     {
         NativeMan.DragWindow(Parent.Handle);
     }
 }
Exemplo n.º 2
0
        public UpdateForm(bool darkMode, string title, string message, string dwnldBtnText, string skipBtnText, string whatsNewBtnText)
        {
            InitializeComponent();

            Height = 244;

            Text = title;
            boxReleaseNotes.Text = whatsNewBtnText;
            messageTextBox.Text  = string.Format(message, UpdateChecker.LatestRelease.TagName, "v" + UpdateChecker.CurrentVersion);
            buttonYes.Text       = dwnldBtnText;
            skipBtn.Text         = skipBtnText;

            infoTooltip.SetToolTip(closeBtn, NativeMan.GetMessageBoxText(NativeMan.DialogBoxCommandID.IDCLOSE) + " | Alt+F4");

            DarkMode          = darkMode;
            closeBtn.DarkMode = darkMode;
            if (darkMode)
            {
                buttonYes.BackColor       = ThemeMan.DarkSecondColor;
                skipBtn.BackColor         = ThemeMan.DarkSecondColor;
                boxReleaseNotes.BackColor = ThemeMan.DarkSecondColor;
                messageTextBox.BackColor  = ThemeMan.DarkBackColor;
                messageTextBox.ForeColor  = Color.White;
            }
        }
Exemplo n.º 3
0
 public static void MoveFileOrFolderToRecycleBin(string path)
 {
     NativeMan.SHFILEOPSTRUCT fileop = new NativeMan.SHFILEOPSTRUCT();
     fileop.wFunc  = NativeMan.FO_DELETE;
     fileop.pFrom  = path + '\0' + '\0';
     fileop.fFlags = NativeMan.FOF_ALLOWUNDO | NativeMan.FOF_NOCONFIRMATION;
     NativeMan.SHFileOperation(ref fileop);
 }
Exemplo n.º 4
0
        internal YesNoForm(
            string messageText,
            string yesBtnText,
            Image yesBtnImage,
            bool showNoBtn,
            string noBtnText,
            Image noBtnImage,
            string windowTitle,
            bool darkMode = false
            )
        {
            InitializeComponent();

            yesBtn.Text = yesBtnText.Length == 0 ? NativeMan.GetMessageBoxText(NativeMan.DialogBoxCommandID.IDYES) : yesBtnText;
            if (yesBtnImage != null)
            {
                yesBtn.Image     = yesBtnImage;
                yesBtn.TextAlign = ContentAlignment.MiddleRight;
                yesBtn.Text      = " " + yesBtn.Text;
            }

            noBtn.Text = noBtnText.Length == 0 ? NativeMan.GetMessageBoxText(NativeMan.DialogBoxCommandID.IDNO) : noBtnText;
            if (noBtnImage != null)
            {
                noBtn.Image     = noBtnImage;
                noBtn.TextAlign = ContentAlignment.MiddleRight;
                noBtn.Text      = " " + noBtn.Text;
            }

            Text           = windowTitle;
            cancelBtn.Text = NativeMan.GetMessageBoxText(NativeMan.DialogBoxCommandID.IDCANCEL);

            textBox.BackColor = BackColor;
            textBox.Text      = messageText;

            if (showNoBtn)
            {
                noBtn.Visible = true;
            }
            else
            {
                Size = new Size(Size.Width, Size.Height - noBtn.Height - 10);
            }

            infoTooltip.SetToolTip(closeBtn, NativeMan.GetMessageBoxText(NativeMan.DialogBoxCommandID.IDCLOSE) + " | Alt+F4");

            DarkMode          = darkMode;
            closeBtn.DarkMode = darkMode;
            if (darkMode)
            {
                yesBtn.BackColor    = ThemeMan.DarkSecondColor;
                noBtn.BackColor     = ThemeMan.DarkSecondColor;
                cancelBtn.BackColor = ThemeMan.DarkSecondColor;
                textBox.ForeColor   = Color.White;
                textBox.BackColor   = ThemeMan.DarkBackColor;
            }
        }
Exemplo n.º 5
0
        public void ProcessPlugin(
            object input,
            string path,
            bool alwaysOnTop,
            object secondaryArg,
            Form mainForm
            )
        {
            if (func.inputRequired && input == null)
            {
                return;
            }

            if (mainForm != null && func.hideMainForm)
            {
                mainForm.Hide();
            }

            object res = null;

            if (pi.dllType == "cpp")
            {
                IntPtr pluginPtr = NativeMan.LoadLibrary(dllPath);
                IntPtr funcPtr   = NativeMan.GetProcAddressOrdinal(pluginPtr, func.name);
                var    callback  = Marshal.GetDelegateForFunctionPointer <PluginMan.RunFunction>(funcPtr);
                res = callback(input, path, darkMode, langCode, alwaysOnTop, secondaryArg);
            }
            else if (pi.dllType == "csharp")
            {
                Assembly assembly = Assembly.LoadFrom(dllPath);
                Type     type     = assembly.GetType(Path.GetFileNameWithoutExtension(dllPath).Replace("-", "_") + ".Main");
                object   instance = Activator.CreateInstance(type);
                res = type.GetMethod(func.name).Invoke(instance, new object[] {
                    input,
                    path,
                    darkMode,
                    langCode,
                    alwaysOnTop,
                    secondaryArg
                }) as object;
            }

            if (res != null)
            {
                PluginMan.OutputEventArgs oea = new PluginMan.OutputEventArgs
                {
                    input = res
                };
                OnOutput(oea);
            }
        }
Exemplo n.º 6
0
        public static void ApplyShadows(IntPtr handle)
        {
            var v = 2;

            NativeMan.DwmSetWindowAttribute(handle, 2, ref v, 4);
            NativeMan.MARGINS margins = new NativeMan.MARGINS()
            {
                Bottom = 1,
                Left   = 1,
                Right  = 1,
                Top    = 1
            };
            NativeMan.DwmExtendFrameIntoClientArea(handle, ref margins);
        }
Exemplo n.º 7
0
        public OkForm(string messageText, string windowTitle, bool darkMode = false)
        {
            InitializeComponent();

            Text       = windowTitle;
            okBtn.Text = NativeMan.GetMessageBoxText(NativeMan.DialogBoxCommandID.IDOK);

            textBox.BackColor = BackColor;
            textBox.Text      = messageText;

            infoTooltip.SetToolTip(closeBtn, NativeMan.GetMessageBoxText(NativeMan.DialogBoxCommandID.IDCLOSE) + " | Alt+F4");

            DarkMode          = darkMode;
            closeBtn.DarkMode = darkMode;
            if (darkMode)
            {
                okBtn.BackColor   = ThemeMan.DarkSecondColor;
                textBox.ForeColor = Color.White;
                textBox.BackColor = ThemeMan.DarkBackColor;
            }
        }
Exemplo n.º 8
0
        public DownloadForm(string url, bool darkMode, string updating, string downloading, string readyToInstall, string failed, string install)
        {
            fileName            = Path.Combine(GetDownloadFolderPath(), System.IO.Path.GetFileName(url));
            this.downloading    = downloading;
            this.readyToInstall = readyToInstall;
            this.failed         = failed;

            InitializeComponent();
            SetDraggableControls(new List <Control>()
            {
                statusLabel
            });

            Text              = updating;
            statusLabel.Text  = downloading;
            updateButton.Text = install;
            cancelButton.Text = NativeMan.GetMessageBoxText(NativeMan.DialogBoxCommandID.IDCANCEL);

            infoTooltip.SetToolTip(closeBtn, NativeMan.GetMessageBoxText(NativeMan.DialogBoxCommandID.IDCLOSE) + " | Alt+F4");

            DarkMode              = darkMode;
            closeBtn.DarkMode     = darkMode;
            progressBar1.DarkMode = darkMode;
            if (darkMode)
            {
                cancelButton.BackColor = ThemeMan.DarkSecondColor;
                updateButton.BackColor = ThemeMan.DarkSecondColor;
            }

            wc = new WebClient();

            wc.DownloadProgressChanged += wc_DownloadProgressChanged;
            wc.DownloadFileCompleted   += wc_DownloadFileCompleted;

            wc.DownloadFileAsync(new Uri(url), fileName);
        }
Exemplo n.º 9
0
 private void GoDrag()
 {
     NativeMan.DragWindow(Handle);
 }