Ejemplo n.º 1
0
        /// <summary>
        /// 初始化操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            #region Register Hot Key

            Manage.WindowMainHandle = new WindowInteropHelper(this).Handle;;

            HotKeyVisualItem hkvi = new HotKeyVisualItem();
            hkvi.HotKeysString = AppInfoOperations.GetHotKey();

            if (hkvi.Available)
            {
                if (!HotKey.TestHotKey(3, System.Windows.Forms.Keys.D1, HotKey.QUICK_SEARCH_HOTKEY_ID, false))
                {
                    if (!HotKey.TestHotKey(3, System.Windows.Forms.Keys.D1, HotKey.QUICK_SEARCH_HOTKEY_ID, false))
                    {
                        tipMainForm.ShowFixed(this, "Hot Key Register failed");
                    }
                }
            }
            else
            {
                if (!HotKey.TestHotKey(3, System.Windows.Forms.Keys.D1, HotKey.QUICK_SEARCH_HOTKEY_ID, false))
                {
                    tipMainForm.ShowFixed(this, "Hot Key Register failed");
                }
            }
            //(uint)HotKey.KeyModifiers.Ctrl | (uint)HotKey.KeyModifiers.Alt


            hkvi = null;

            #endregion


            #region Initialize Visual Settings
            this.WindowState = WindowState.Normal;
            double ScreenWidth  = SystemParameters.PrimaryScreenWidth;
            double ScreenHeight = SystemParameters.PrimaryScreenHeight;

            //获取位置
            //并检查合法性
            double readLeft = AppInfoOperations.GetLeft();
            double readTop  = AppInfoOperations.GetTop();

            if (readLeft > 2)
            {
                this.Left = readLeft - 2;
            }
            else
            {
                this.Left = 0;
            }

            if (readTop > 1)
            {
                this.Top = readTop - 1;
            }
            else
            {
                this.Top = 0;
            }

            //获取宽高
            double readWidth  = AppInfoOperations.GetWidth();
            double readHeight = AppInfoOperations.GetHeight();

            //检查数值合法性
            if (readWidth > ScreenWidth)
            {
                readWidth = ScreenWidth;
            }
            if (readHeight > ScreenHeight)
            {
                readHeight = ScreenHeight;
            }

            //应用宽高
            this.Width  = readWidth;
            this.Height = readHeight;

            #endregion


            #region Initialize Background Data

            //用于自动存储位置大小的开关指示
            IsInformationsInitialized = true;

            //初始化后台数据
            Manage.InitializeData(this);

            //初始化删除计时器
            Manage.timer.Interval = TimeSpan.FromSeconds(3);
            Manage.timer.Stop();
            Manage.timer.Tick += Timer_Tick;

            //其他
            MELeave.RoutedEvent = Border.MouseLeaveEvent;
            MEEnter.RoutedEvent = Border.MouseEnterEvent;

            tipMainForm.Show();

            //获取插件
            Anything_wpf_main_.cls.Plugins.GetPlugins();

            //关联事件处理
            this.StateChanged += new EventHandler(animationInstance.Window_StateChanged);
            this.SizeChanged  += new SizeChangedEventHandler(animationInstance.Window_SizeChanged);

            //设置窗体渐隐与显示
            animationInstance.InitBdrStyle(ref this.bdrMain);

            //关闭加载窗体
            Manage.WindowLoading.Close();

            #endregion
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 初始化操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            wndProgressBar wndpb = new wndProgressBar(AllLoadHeader, AllLoadFooter, 100);

            #region Load language and register hotkey

            //加载语言
            Manage.LoadingLanguage();

            //注册热键
            Manage.WindowMainHandle = new WindowInteropHelper(this).Handle;;

            HotKeyVisualItem hkvi = new HotKeyVisualItem();

            if (hkvi.OuterGetKeys(AppInfoOperations.GetHotKey()))
            {
                if (!HotKey.TestHotKey(3, System.Windows.Forms.Keys.D1, HotKey.QUICK_SEARCH_HOTKEY_ID, false))
                {
                    tipMainForm.ShowFixed(this, this.HotKeyFailed);
                }
            }
            else
            {
                if (!HotKey.TestHotKey(3, System.Windows.Forms.Keys.D1, HotKey.QUICK_SEARCH_HOTKEY_ID, false))
                {
                    tipMainForm.ShowFixed(this, this.HotKeyFailed);
                }
            }

            hkvi = null;

            wndpb.Increase(25);

            #endregion


            #region Initialize Visual Settings
            this.WindowState = WindowState.Normal;
            double ScreenWidth  = SystemParameters.PrimaryScreenWidth;
            double ScreenHeight = SystemParameters.PrimaryScreenHeight;

            //获取位置
            //并检查合法性
            double readLeft = AppInfoOperations.GetLeft();
            double readTop  = AppInfoOperations.GetTop();

            if (readLeft > 2)
            {
                this.Left = readLeft - 2;
            }
            else
            {
                this.Left = 0;
            }

            if (readTop > 1)
            {
                this.Top = readTop - 1;
            }
            else
            {
                this.Top = 0;
            }

            //获取宽高
            double readWidth  = AppInfoOperations.GetWidth();
            double readHeight = AppInfoOperations.GetHeight();

            //检查数值合法性
            if (readWidth > ScreenWidth)
            {
                readWidth = ScreenWidth;
            }
            if (readHeight > ScreenHeight)
            {
                readHeight = ScreenHeight;
            }

            //应用宽高
            this.Width  = readWidth;
            this.Height = readHeight;


            wndMainCB = new ControlBackground(Manage.CurrentPath + "Background\\", new Packer(this.bdrMainForm), ApplicationInformations.Anything.AppInfoOperations.GetBackgroundIntervalMilliseconds(), true);

            ClearSearch();

            wndpb.Increase(25);

            #endregion


            #region Initialize Background Data

            //用于自动存储位置大小的开关指示
            IsInformationsInitialized = true;

            //初始化后台数据
            Manage.InitializeProgram();

            wndpb.Increase(25);

            ////初始化删除计时器
            //Manage.timer.Interval = TimeSpan.FromSeconds(3);
            //Manage.timer.Stop();
            //Manage.timer.Tick += Timer_Tick;

            //其他
            MELeave.RoutedEvent = Border.MouseLeaveEvent;
            MEEnter.RoutedEvent = Border.MouseEnterEvent;

            //获取插件
            Class.Plugins.GetPlugins();

            //关联事件处理
            this.StateChanged += new EventHandler(animationInstance.Window_StateChanged);
            this.SizeChanged  += new SizeChangedEventHandler(animationInstance.Window_SizeChanged);

            //设置窗体渐隐与显示
            animationInstance.InitBdrStyle(ref this.bdrMain);


            //关闭加载窗体
            //Manage.WindowLoading.Close();

            wndpb.Increase(25);

            #endregion

            wndpb.Increase();
        }