Exemple #1
0
        public static void SaveSettingsEvent(int windowPosX, int windowPosY, int windowZoomRatio, int windowOpacity)
        {
            int    preload = new IOEvent().FileIsExist();
            string savedSettingsContent = windowPosX.ToString() + "/" + windowPosY.ToString() + "/" + windowZoomRatio.ToString() + "/" + windowOpacity.ToString();

            File.WriteAllText(new IOEvent().path + "/Settings.novs", savedSettingsContent, Encoding.UTF8);
        }
Exemple #2
0
 private void SavingPreparationEvent(object sender, EventArgs e)
 {
     if (saveCountDown == 0)
     {
         saveSettingsTimer.Stop();
         saveWindowPosX      = (int)Main.that.mainWindow.Left;
         saveWindowPosY      = (int)Main.that.mainWindow.Top;
         saveWindowZoomRatio = (int)size_slider.Value;
         saveWindowOpac      = (int)opac_slider.Value;
         IOEvent.SaveSettingsEvent(saveWindowPosX, saveWindowPosY, saveWindowZoomRatio, saveWindowOpac);
         SettingBoxFadeOut();
     }
     else
     {
         saveCountDown--;
     }
 }
Exemple #3
0
        public static void ReadSettingsEvent()
        {
            int preload = new IOEvent().FileIsExist();

            if (preload == 0)
            {
            }
            else
            {
                var      Settings      = File.ReadAllText(new IOEvent().path + "/Settings.novs");
                string[] SettingsArray = Settings.Split('/');
                Conf.WindowResX    = int.Parse(SettingsArray[0]);
                Conf.WindowResY    = int.Parse(SettingsArray[1]);
                Conf.ZoomRaw       = int.Parse(SettingsArray[2]);
                Conf.ZoomRatio     = (double)Conf.ZoomRaw / 50;
                Conf.WindowOpacity = int.Parse(SettingsArray[3]);
            }
        }
        internal static void Init()
        {
            ///<summary>
            ///初始化插件信息
            ///</summary>
            InitPluginConfigs();
            AsyncInitalizationEventBind();


            /// <summary>
            /// 设置鼠标穿透
            /// </summary>
            Main.that.mainWindow.SourceInitialized += delegate
            {
                var hwnd          = new WindowInteropHelper(Main.that.mainWindow).Handle;
                var extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
                SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);
            };

            IOEvent.ReadSettingsEvent();

            double resW          = 140;
            double resH          = 45;
            double fontSizeTitle = 9;
            double fontSizeValue = 30;

            Console.WriteLine("[DEBUG] ZoomRatio: " + ZoomRatio.ToString());
            resW          = resW * Conf.ZoomRatio;
            resH          = resH * Conf.ZoomRatio;
            fontSizeTitle = fontSizeTitle * Conf.ZoomRatio;
            fontSizeValue = fontSizeValue * Conf.ZoomRatio;
            Main.that.mainWindow.Width  = resW;
            Main.that.mainWindow.Height = resH;
            Main.that.mainWindow.labelViewer.FontSize = fontSizeTitle;
            Main.that.mainWindow.textCount.FontSize   = fontSizeValue;
            Main.that.mainWindow.Alert.FontSize       = fontSizeTitle * 0.8;
            Main.that.mainWindow.Left    = WindowResX;
            Main.that.mainWindow.Top     = WindowResY;
            Main.that.mainWindow.Opacity = WindowOpacity / 100;
            Main.that.controlWindow.opac_slider.Value = WindowOpacity;
            Main.that.controlWindow.size_slider.Value = ZoomRaw;
        }