Exemple #1
0
 public FormUpdateMessage()
 {
     this.InitializeComponent();
     this.Icon = ImageHelper.getDllIcon("32.ico", HNStruct.OemType);
     this.Text = Fixer4Main.FormTitle();
     this.CenterToScreen();
 }
Exemple #2
0
        public HuionTalbet()
        {
            this.InitializeComponent();
            this.ControlBox      = true;
            DeployConfig.isNewUI = true;
            SettingsUtil.CreateSettingsXml();
            this.setViewText8Locale();
            this.mForms = new List <Form>();
            ThreadPool.SetMaxThreads(5, 5);
            this.notifyIcon1.Icon = Fixer4Main.getNotifyIcon(false);

            if (Utils.isWin10)
            {
                SettingsUtil.setAutorun(false);
            }
            else
            {
                SettingsUtil.isCommonStartup = false;
            }

            this.checkForegroundWindowInterval          = new Timer();
            this.checkForegroundWindowInterval.Interval = 500;
            this.checkForegroundWindowInterval.Tick    += checkForegroundWindowTick;
            initPerAppSettings();
        }
Exemple #3
0
 public HuionMessageBox()
 {
     this.InitializeComponent();
     this.ShowSettingsIcon = false;
     this.Icon             = ImageHelper.getDllIcon("32.ico", HNStruct.OemType);
     this.Text             = Fixer4Main.FormTitle();
     this.CenterToScreen();
 }
Exemple #4
0
 private void trackBar1_Scroll(object sender, EventArgs e)
 {
     TabletConfigUtils.config.pressFactor = this.trackBar1.Value;
     this.pictureBoxPressCurve.Refresh();
     if (!DeployConfig.isNewUI)
     {
         return;
     }
     Fixer4Main.applayClick((object)null, (EventArgs)null);
 }
Exemple #5
0
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            switch (m.Msg)
            {
            case 126:
                break;

            case 512:
                TimerSession.userOperation();
                break;

            case 536:
                switch (m.WParam.ToInt32())
                {
                case 4:
                    this.timer3.Stop();
                    ThreadPool.QueueUserWorkItem(new WaitCallback(TabletConfigUtils.closeDevice));
                    break;

                case 7:
                    this.timer3.Start();
                    break;
                }

                MiddleModule.eventPost += new Post(this.MiddleModule_eventPost);
                break;

            case 1044:
                break;

            case 1054:
                if (this.Visible)
                {
                    break;
                }
                this.Show();
                this.WindowState = FormWindowState.Normal;
                break;

            case 1064:
                if (this.Visible)
                {
                    break;
                }
                KeyboardUtils.listenHotKey(this.Handle, new Void(this.KeyboardUtils_showFormEvent),
                                           SettingsUtil.ShowUIShortcut);
                break;

            default:
                Fixer4Main.onDeviceChanged(ref m);
                KeyboardUtils.onHotKey(ref m);
                break;
            }
        }
Exemple #6
0
 private void HuionTalbet_Load(object sender, EventArgs e)
 {
     Fixer4Main.MainForm = (Form)this;
     if (!SettingsUtil.CheckHotkey(this.Handle))
     {
         HuionMessageBox.HotkeyConflict();
     }
     this.tsmiSettings.Image = (Image)ImageHelper.getDllImage("settings.png");
     this.Icon = ImageHelper.getDllIcon("32.ico", HNStruct.OemType);
     MiddleModule.initMainFormHandle((Form)this);
     MiddleModule.eventPost += new Post(this.MiddleModule_eventPost);
     this.timer3.Start();
     Fixer4Main.setDisplayChangedCallback(
         new SystemSessionService.SystemDisplayChangedCallback(this.onDisplayChanged));
     Fixer4Main.listenSystemStatus();
     DeviceStatusUtils.deviceConfigListener +=
         new DeviceStatusUtils.DeviceConfigChanged(this.onDeviceConfigChanged);
     this.btnApplay.Click     += new EventHandler(Fixer4Main.applayClick);
     this.btnOK.Click         += new EventHandler(Fixer4Main.okClick);
     this.btnClose.Click      += new EventHandler(Fixer4Main.closeClick);
     this.btnAdmin.MouseDown  += new MouseEventHandler(this.btnColor);
     this.btnApplay.MouseDown += new MouseEventHandler(this.btnColor);
     this.btnOK.MouseDown     += new MouseEventHandler(this.btnColor);
     this.btnClose.MouseDown  += new MouseEventHandler(this.btnColor);
     this.btnAdmin.MouseUp    += new MouseEventHandler(this.btnColorDefault);
     this.btnApplay.MouseUp   += new MouseEventHandler(this.btnColorDefault);
     this.btnOK.MouseUp       += new MouseEventHandler(this.btnColorDefault);
     this.btnClose.MouseUp    += new MouseEventHandler(this.btnColorDefault);
     this.FormClosed          += new FormClosedEventHandler(Fixer4Main.FormClosed);
     this.KeyDown             += new KeyEventHandler(KeyboardUtils.onKeyDown);
     this.displayFormation();
     this.KeyPreview = true;
     this.buttonInfo_Click(sender, (EventArgs)null);
     this.SetDisplayMonitors();
     this.panelHotKey.MouseMove    += new MouseEventHandler(Fixer4Main.onMouseMove);
     this.panelInfo.MouseMove      += new MouseEventHandler(Fixer4Main.onMouseMove);
     this.panelTabletPen.MouseMove += new MouseEventHandler(Fixer4Main.onMouseMove);
     this.panelWorkArea.MouseMove  += new MouseEventHandler(Fixer4Main.onMouseMove);
     this.panel1.MouseMove         += new MouseEventHandler(Fixer4Main.onMouseMove);
     this.btnAdmin.Click           += new EventHandler(Fixer4Main.adminClick);
     this.panelHotKey.Tag           = (object)TabType.TabHotkey;
     this.panelInfo.Tag             = (object)TabType.TabInfo;
     this.panelTabletPen.Tag        = (object)TabType.TabTabletPen;
     this.panelWorkArea.Tag         = (object)TabType.TabWorkArea;
     TimerSession.UserLongtimeNoOperationListener +=
         new TimerSession.UserLongtimeNoOperationCallback(this.onUserLongtimeNoOperation);
     TimerSession.AutoOperationListener += new ElapsedEventHandler(Fixer4Main.T_Elapsed);
     new Thread(new ThreadStart(myThread)).Start();
     this.timer2.Start();
     this.Hide();
     this.WindowState             = FormWindowState.Minimized;
     this.notifyIcon1.MouseClick += new MouseEventHandler(this.notifyIcon1_MouseClick);
 }
Exemple #7
0
 private void displayFormation()
 {
     this.labelTabletState.Text  = HNStruct.tabletTextInfo;
     this.panelInfo.Enabled      = HNStruct.globalInfo.bOpenedTablet;
     this.panelWorkArea.Enabled  = HNStruct.globalInfo.bOpenedTablet;
     this.panelTabletPen.Enabled = HNStruct.globalInfo.bOpenedTablet;
     this.panelHotKey.Enabled    = HNStruct.globalInfo.bOpenedTablet;
     this.btnOK.Enabled          = HNStruct.globalInfo.bOpenedTablet;
     this.btnApplay.Enabled      = HNStruct.globalInfo.bOpenedTablet;
     this.notifyIcon1.Icon       = Fixer4Main.getNotifyIcon(HNStruct.globalInfo.bOpenedTablet);
     this.btnAdmin.Visible       = !Utils.isAdmin();
 }
Exemple #8
0
 private void setViewText8Locale()
 {
     this.panelHotKey.Text    = ResourceCulture.GetString("FormHuionTablet_lbHotKeyText");
     this.panelTabletPen.Text = ResourceCulture.GetString("FormHuionTablet_lbTabletPenText");
     this.panelWorkArea.Text  = ResourceCulture.GetString("FormHuionTablet_lbWorkAreaText");
     this.panelInfo.Text      = ResourceCulture.GetString("FormHuionTablet_lbInfoText");
     this.btnOK.Text          = ResourceCulture.GetString("FormHuionTablet_btOKText");
     this.btnClose.Text       = ResourceCulture.GetString("closeForm");
     this.btnApplay.Text      = ResourceCulture.GetString("FormHuionTablet_btAppText");
     this.Text = Fixer4Main.FormTitle();
     HNStruct.tabletTextInfo       = Fixer4Main.getStatusText(false);
     this.labelTabletState.Enabled = false;
     this.labelTabletState.Text    = HNStruct.tabletTextInfo;
     this.tsmiExit.Text            = ResourceCulture.GetString("FormHuionTablet_exit");
     this.tsmiSettings.Text        = ResourceCulture.GetString("SettingsTitle");
     this.notifyIcon1.Text         = ResourceCulture.GetString("FormHuionTabletNotifyIconText");
     this.btnAdmin.Text            = ResourceCulture.GetString("applyAdmin");
 }
Exemple #9
0
        private void setViewState(bool enabled)
        {
            if (this.curEnabled != enabled)
            {
                this.labelTabletState.Text    = Fixer4Main.getStatusText(enabled);
                this.labelTabletState.Enabled = enabled;
                this.panelHotKey.Enabled      = enabled;
                this.panelTabletPen.Enabled   = enabled;
                this.panelWorkArea.Enabled    = enabled;
                this.panelInfo.Enabled        = enabled;
                this.btnOK.Enabled            = enabled;
                this.btnApplay.Enabled        = enabled;
                this.notifyIcon1.Icon         = Fixer4Main.getNotifyIcon(enabled);
                this.showBalloonTip();
                this.setPanelWindow();
            }

            this.curEnabled = enabled;
        }
Exemple #10
0
        private void FormEKey_Load(object sender, EventArgs e)
        {
            this.Icon           = Fixer4Main.FormIcon();
            this.labelPath.Text = new string(this.m_Ekey.cmdPath);
            this.setViewText8Locale();
            this.BringToFront();
            this.comboBoxStr.Items.Clear();
            this.comboBoxStr.MeasureItem += new MeasureItemEventHandler(this.comboBoxStr_MeasureItem);
            for (int index = 0; index < KBTable.KeyBoards.Count; ++index)
            {
                KBTable keyBoard = KBTable.KeyBoards[index];
                this.comboBoxStr.Items.Add((object)keyBoard);
                if ((int)this.m_Ekey.kbtn.kbKeys[0] == (int)keyBoard.keyCode)
                {
                    this.comboBoxStr.Text = keyBoard.ToString();
                }
            }

            this.updateHNConfigToView();
        }
Exemple #11
0
 private void timer3_Tick(object sender, EventArgs e)
 {
     Fixer4Main.OpenDevice();
 }
Exemple #12
0
        private void handleFocusChange(string processFileName)
        {
            if (!HNStruct.globalInfo.bOpenedTablet)
            {
                // Too early, driver not loaded
                return;
            }
            if (this.currentSettings != null &&
                (processFileName.Equals(Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName.ToLower())) ||
                 SettingsUtil.excludedApplications.Contains(processFileName)))
            {
                // Excluded app
                return;
            }

            HNStruct.PerAppSetting appSetting;
            if (this.perAppSettings.ContainsKey(processFileName) && this.perAppSettings[processFileName].enabled)
            {
                appSetting = this.perAppSettings[processFileName];
            }
            else if (this.perAppSettingsDefault.HasValue && this.perAppSettingsDefault.Value.enabled)
            {
                appSetting = this.perAppSettingsDefault.Value;
            }
            else
            {
                // No setting found
                return;
            }

            if (appSetting.profile.Equals(this.currentSettings))
            {
                HuionLog.printLog("FocusChanged", "Error: already active");
                // already active
                return;
            }

            string path = Path.GetFullPath(Path.Combine(this.perAppSettingsProfileDir, appSetting.profile));

            if (!File.Exists(path))
            {
                HuionLog.printLog("FocusChanged", "Error: file not found");
                return;
            }

            HuionLog.printLog("FocusChanged", "Info: loading profile");


            IntPtr coTaskMemAuto = Marshal.StringToCoTaskMemAuto(path);

            Marshal.AllocHGlobal(Marshal.SizeOf(typeof(HNStruct.HNConfigXML)));
            IntPtr num = HuionDriverDLL.hnx_read_config(ref HNStruct.globalInfo.tabletInfo, coTaskMemAuto);

            TabletConfigUtils.config =
                (HNStruct.HNConfigXML)Marshal.PtrToStructure(num, typeof(HNStruct.HNConfigXML));
            new TabletConfigUtils().SetConfig(TabletConfigUtils.config);
            Marshal.FreeHGlobal(coTaskMemAuto);
            Marshal.FreeHGlobal(num);
            currentSettings = appSetting.profile;
            Fixer4Main.applayClick(null, null);

            HuionLog.printLog("FocusChanged", "Info: profile loaded");

            this.notifyIcon1.ShowBalloonTip(3, "Profile switched",
                                            Path.GetFileNameWithoutExtension(appSetting.profile), ToolTipIcon.Info);
            this.notifyIcon1.Text = $"{ResourceCulture.GetString("FormHuionTabletNotifyIconText")}" +
                                    $" ({Path.GetFileNameWithoutExtension(appSetting.profile)})";


            // Refresh Info
            if (this.panelWindow.Controls.Count > 0)
            {
                this.mTabType = TabType.TabWorkArea;
                this.buttonInfo_Click(null, null);
            }
            this.ResumeLayout(false);
        }
Exemple #13
0
        private static void Main(string[] args)
        {
            HNStruct.OemType = DeployConfig.getOemType();
            HuionLog.listenGlobalCrashLog();
            ResourceCulture.init();
            TimerSession.startListenUserOperation();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            bool flag = false;

            try
            {
                flag = Utils.isAppRunning();
            }
            catch
            {
                Utils.runAsAdmin(true);
                return;
            }

            if (new Mutex(true, "OnlyRun").WaitOne(0, false))
            {
                Application.Run((Form) new HuionTalbet());
            }
            else
            {
                if (Utils.isStartup(args) ||
                    HuionDriverDLL.PostMessage(HuionDriverDLL.FindWindow((string)null, Fixer4Main.FormTitle()), 1054,
                                               IntPtr.Zero, IntPtr.Zero) != 0)
                {
                    return;
                }
                Utils.runAsAdmin(true);
            }
        }
Exemple #14
0
 private void FormUpdater_Load(object sender, EventArgs e)
 {
     this.Text = "在线更新";
     this.Icon = Fixer4Main.FormIcon();
 }