Beispiel #1
0
        private static void Main()
        {
            // Enable visual styles and better text rendering
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);

            // Get the default local application data path
            AppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            AppDataPath = Path.Combine(AppDataPath, Application.ProductName);

            #region --------------------[ DEBUG MODE BLOCK ]--------------------

#if DEBUG
            // Use a proper application data folder for debug mode
            AppDataPath = Path.Combine(AppDataPath, "[DEBUG]");
#endif

            #endregion

            // Create the application data folder if it doesn't exist
            if (!Directory.Exists(AppDataPath))
            {
                Directory.CreateDirectory(AppDataPath);
            }

            // Initializes CefSharp with the default settings
            Cef.Initialize(new CefSettings {
                BrowserSubprocessPath = BrowserSubprocessFileName,
                CachePath             = Path.Combine(AppDataPath, CacheFolderName),
                LogFile = Path.Combine(AppDataPath, LogFileName)
            });

            // Separate cookies storage location from the cache
            Cef.SetCookiePath(Path.Combine(AppDataPath, CookiesFolderName), false);

            // Initialize a new instance of the wrapper form
            WrapperForm = new WrapperForm();

            // Initialize a new instance of the Easy Settings class
            Settings = new EasySettings <ApplicationSettings>(Path.Combine(AppDataPath, SettingsFileName), "Settings");

            // Run the application with a notification context
            Application.Run(new NotificationContext());
        }
Beispiel #2
0
        public void onInitialize(ISettings settings)
        {
            box?.close();
            box          = null;
            Extra        = Extra ?? new EasySettings();
            skipTVGiftDm = Extra.get("skip-tv-gift-danmaku", false);
            Extra.put("skip-tv-gift-danmaku", skipTVGiftDm);
            var defaultBox = typeof(MessageFlowBox).Name;
            var boxType    = Extra.get("token-box", defaultBox);
            var app        = Application.Current;

            if (defaultBox.Equals(boxType))
            {
                Extra.put("token-box", typeof(MessageFlowBox).Name);
                app.Dispatcher.Invoke(() => {
                    var win = Application.Current?.MainWindow;
                    box     = new MessageFlowBox(Extra)
                    {
                        Owner = win
                    };
                });
            }
            else
            {
                Extra.put("token-box", typeof(FloatingBox).Name);
                app.Dispatcher.Invoke(() => {
                    var win = app?.MainWindow;
                    box     = new FloatingBox(Extra)
                    {
                        Owner = win
                    };
                });
            }
            box.setOnClick(() => {
                box.addMessage("Tips", "Nothing yet!");
            });
        }
Beispiel #3
0
        private static void Main() {
            // Enable visual styles and better text rendering
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);

            // Get the default local application data path
            AppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            AppDataPath = Path.Combine(AppDataPath, Application.ProductName);

            #region --------------------[ DEBUG MODE BLOCK ]--------------------

#if DEBUG
            // Use a proper application data folder for debug mode
            AppDataPath = Path.Combine(AppDataPath, "[DEBUG]");
#endif

            #endregion

            // Create the application data folder if it doesn't exist
            if(!Directory.Exists(AppDataPath)) {
                Directory.CreateDirectory(AppDataPath);
            }

            // Initializes CefSharp with the default settings
            Cef.Initialize(new CefSettings {
                BrowserSubprocessPath = BrowserSubprocessFileName,
                CachePath = Path.Combine(AppDataPath, CacheFolderName),
                LogFile = Path.Combine(AppDataPath, LogFileName)
            });

            // Separate cookies storage location from the cache
            Cef.SetCookiePath(Path.Combine(AppDataPath, CookiesFolderName), false);

            // Initialize a new instance of the wrapper form
            WrapperForm = new WrapperForm();

            // Initialize a new instance of the Easy Settings class
            Settings = new EasySettings<ApplicationSettings>(Path.Combine(AppDataPath, SettingsFileName), "Settings");

            // Run the application with a notification context
            Application.Run(new NotificationContext());
        }
Beispiel #4
0
 public void onInitialize(ISettings appSettings)
 {
     Extra        = Extra ?? new EasySettings();//Get plugin settings
     idleDuration = Math.Max(Extra.get("idle-duration", (int)5000), 5000);
     Extra.put("idle-duration", idleDuration);
 }