Ejemplo n.º 1
0
 //清除背景方法
 private void ClearBackground()
 {
     Visi.VisiCol(true, UI_BackGroundBorder);
     Se_BG_Alpha_Text.Foreground = Brushes.Silver;
     Se_BG_Alpha.IsEnabled       = false;
     RegeditRW.RegWrite("Background", "");
 }
Ejemplo n.º 2
0
        //设置背景拉伸方式
        private void Se_ComboBox_Background_Stretch_SelectionChanged(Object sender, SelectionChangedEventArgs e)
        {
            string bg = RegeditRW.RegReadString("Background");

            if (MWInit == true)
            {
                if (bg == "")
                {
                    Se_BG_Alpha_Text.Foreground = Brushes.Silver;
                    Se_BG_Alpha.IsEnabled       = false;
                }
                else
                {
                    Se_BG_Alpha_Text.Foreground = Brushes.Black;
                    try
                    {
                        var brush = new ImageBrush();
                        brush.ImageSource = new BitmapImage(new Uri(bg));
                        brush.Stretch     = (Stretch)Se_ComboBox_Background_Stretch.SelectedIndex;
                        UI_BackGroundBorder.Background = brush;
                        RegeditRW.RegWrite("BackgroundStretch", Se_ComboBox_Background_Stretch.SelectedIndex + 1);
                    }
                    catch
                    {
                        Visi.VisiCol(true, UI_BackGroundBorder);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 //游戏版本选择
 private void UI_gameversion_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (MWInit == true)
     {
         LoadGameVersionXml();
         RegeditRW.RegWrite("GameVersion", UI_gameversion.SelectedIndex);
     }
 }
Ejemplo n.º 4
0
 //游戏版本选择
 private void UI_gameversion_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (MWInit == true)
     {
         LoadGameVersionXml();
         RegeditRW.RegWrite("GameVersion", UI_gameversion.SelectedIndex);
         button_CS_Reset_Click(null, null);//模拟初始化
     }
 }
Ejemplo n.º 5
0
 //修改字体
 private void Se_ComboBox_Font_SelectionChanged(Object sender, SelectionChangedEventArgs e)
 {
     if (loadFont == true)
     {
         List <string> Ls = new List <string>();
         foreach (TextBlock TB in Se_ComboBox_Font.Items)
         {
             Ls.Add(TB.Text);
         }
         mainWindow.FontFamily = new FontFamily(Ls[Se_ComboBox_Font.SelectedIndex]);
         RegeditRW.RegWrite("MainWindowFont", Ls[Se_ComboBox_Font.SelectedIndex]);
     }
 }
Ejemplo n.º 6
0
        private void BtnSave_OnClick(object sender, RoutedEventArgs e)
        {
            bool isAutoRun = (bool)CbAutoRun.IsChecked;
            bool r         = RegeditRW.SetIsAutoRun(isAutoRun);

            if (r == false)
            {
                MessageBox.Show("保存失败");
            }
            else
            {
                MessageBox.Show("保存成功");
            }
        }
Ejemplo n.º 7
0
 //窗口置顶
 private void Se_button_Topmost_Click(object sender, RoutedEventArgs e)
 {
     if (Topmost == false)
     {
         Topmost = true;
         Se_image_Topmost.Source   = RSN.PictureShortName(RSN.ShortName("Setting_Top_T"));
         Se_textblock_Topmost.Text = "永远置顶";
         RegeditRW.RegWrite("Topmost", 1);
     }
     else
     {
         Topmost = false;
         Se_image_Topmost.Source   = RSN.PictureShortName(RSN.ShortName("Setting_Top_F"));
         Se_textblock_Topmost.Text = "永不置顶";
         RegeditRW.RegWrite("Topmost", 0);
     }
 }
Ejemplo n.º 8
0
 //MainWindow窗口尺寸改变
 private void mainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     //最大化
     if (WindowState == WindowState.Maximized)
     {
         WindowState = WindowState.Normal;
         UI_btn_maximized_Click(null, null);
     }
     //设置版本号位置
     UI_Version.Margin = new Thickness(10, mainWindow.ActualHeight - 35, 0, 0);
     //左侧面板高度
     LeftCanvas.Height    = mainWindow.ActualHeight - 2;
     LeftWrapPanel.Height = mainWindow.ActualHeight - 2;
     //Splitter高度
     UI_Splitter.Height = ActualHeight - 52;
     RegeditRW.RegWrite("MainWindowHeight", ActualHeight);
     RegeditRW.RegWrite("MainWindowWidth", ActualWidth);
 }
Ejemplo n.º 9
0
        //MainWindow窗口加载
        private void mainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            new KeyboardHandler(this);   //加载快捷键
            foreach (string str in rF()) //加载字体
            {
                TextBlock TB = new TextBlock();
                TB.Text       = str;
                TB.FontFamily = new FontFamily(str);
                Se_ComboBox_Font.Items.Add(TB);
            }
            string        mainWindowFont = RegeditRW.RegReadString("MainWindowFont");
            List <string> Ls             = new List <string>();

            foreach (TextBlock TB in Se_ComboBox_Font.Items)
            {
                Ls.Add(TB.Text);
            }
            Se_ComboBox_Font.SelectedIndex = Ls.IndexOf(mainWindowFont);
            loadFont = true;
            LoadGameVersionXml();//加载游戏版本Xml文件
        }
Ejemplo n.º 10
0
        //设置背景方法
        public void SetBackground()
        {
            var OFD = new Microsoft.Win32.OpenFileDialog()
            {
                FileName   = "",                                                                    //默认文件名
                DefaultExt = ".png",                                                                // 默认文件扩展名
                Filter     = "图像文件 (*.bmp;*.gif;*.jpg;*.jpeg;*.png)|*.bmp;*.gif;*.jpg;*.jpeg;*.png" //文件扩展名过滤器
            };
            bool?result = OFD.ShowDialog();                                                         //显示打开文件对话框

            Visi.VisiCol(false, UI_BackGroundBorder);
            try
            {
                string PictruePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\JiHuangBaiKeCSharp\Background\"; //设置文件夹位置
                if ((Directory.Exists(PictruePath)) == false)                                                                               //若文件夹不存在
                {
                    Directory.CreateDirectory(PictruePath);
                }
                var filename = Path.GetFileName(OFD.FileName); //设置文件名
                try
                {
                    File.Copy(OFD.FileName, PictruePath + filename, true);
                }
                catch (Exception) { }
                var brush = new ImageBrush()
                {
                    ImageSource = new BitmapImage(new Uri(PictruePath + filename))
                };
                UI_BackGroundBorder.Background = brush;
                Se_BG_Alpha_Text.Foreground    = Brushes.Black;
                Se_BG_Alpha.IsEnabled          = true;
                RegeditRW.RegWrite("Background", PictruePath + filename);
            }
            catch (Exception)
            {
                MessageBox.Show("没有选择正确的图片");
            }
        }
Ejemplo n.º 11
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            if (Debugger.IsAttached)  //调试模式
            {
                this.Topmost = false; //防止挡住代码
            }

            //LocationTestBox1.Logs = Logs;
            InitData();

            ServerManagerBox1.Init();

            if (EngineClientSetting.AutoStart)
            {
                ShowEngineClientWindow();
            }

            //var hex = "10 01 C0 01 02 85 A4 F4 8C C0 3A";
            //var bytes = ByteHelper.HexToBytes(hex);
            //var str = "85A4";
            //byte[] bytes1 = Encoding.UTF8.GetBytes(str);
            //byte[] bytes2 = Encoding.UTF32.GetBytes(str);
            //byte[] bytes4 = Encoding.ASCII.GetBytes(str);
            //byte[] bytes5 = Encoding.UTF7.GetBytes(str);
            //byte[] bytes6 = Encoding.Default.GetBytes(str);

            version = ConfigurationHelper.GetValue("ServerVersionCode");

            clientVersion = ConfigurationHelper.GetValue("ClientVersionCode");

            this.Title = "服务端    -v" + version + "," + clientVersion;

            var isStartDaemon = ConfigurationHelper.GetBoolValue("StartDaemon");

            if (isStartDaemon && Debugger.IsAttached == false)
            {
                StartDaemon(false);
            }

            bool isAutoRun = RegeditRW.ReadIsAutoRun();

            var registerDaemonAutoRun = ConfigurationHelper.GetBoolValue("RegisterDaemonAutoRun");

            if (registerDaemonAutoRun)
            {
                if (isAutoRun == false)
                {
                    RegeditRW.SetIsAutoRun(true);
                    string path2 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
                    Log.Info(LogTags.Server, "注册开机自启动:" + path2);
                }
                else
                {
                    Log.Info(LogTags.Server, "开机自启动:" + isAutoRun);
                }
            }
            else
            {
                Log.Info(LogTags.Server, "开机自启动:" + isAutoRun);
            }

            timeTimer          = new DispatcherTimer();
            timeTimer.Interval = TimeSpan.FromMilliseconds(500);
            //timer2.Interval = TimeSpan.FromSeconds(1);
            timeTimer.Tick += TimeTimer_Tick;
            timeTimer.Start();

            StaticEvents.LocateArchorByIp += StaticEvents_LocateArchorByIp;
        }
Ejemplo n.º 12
0
        private void SettingWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            bool isAutoRun = RegeditRW.ReadIsAutoRun();

            CbAutoRun.IsChecked = isAutoRun;
        }
Ejemplo n.º 13
0
 //设置窗口透明度
 private void Se_Window_Alpha_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     Opacity = Se_Window_Alpha.Value / 100;
     Se_Window_Alpha_Text.Text = "窗口不透明度:" + (int)Se_Window_Alpha.Value + "%";
     RegeditRW.RegWrite("WindowAlpha", Se_Window_Alpha.Value + 1);
 }
Ejemplo n.º 14
0
 //设置面板透明度
 private void Se_Panel_Alpha_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     RightGrid.Background.Opacity = Se_Panel_Alpha.Value / 100;
     Se_Panel_Alpha_Text.Text     = "面板不透明度:" + (int)Se_Panel_Alpha.Value + "%";
     RegeditRW.RegWrite("BGPanelAlpha", Se_Panel_Alpha.Value + 1);
 }
Ejemplo n.º 15
0
 //设置背景透明度
 private void Se_BG_Alpha_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     UI_BackGroundBorder.Opacity = Se_BG_Alpha.Value / 100;
     Se_BG_Alpha_Text.Text       = "背景不透明度:" + (int)Se_BG_Alpha.Value + "%";
     RegeditRW.RegWrite("BGAlpha", Se_BG_Alpha.Value + 1);
 }
Ejemplo n.º 16
0
        //MainWindow构造函数
        public MainWindow()
        {
            #region "读取注册表(必须在初始化之前读取)"
            //背景图片
            string bg        = RegeditRW.RegReadString("Background");
            double bgStretch = RegeditRW.RegRead("BackgroundStretch");
            //透明度
            double bgAlpha      = RegeditRW.RegRead("BGAlpha");
            double bgPanelAlpha = RegeditRW.RegRead("BGPanelAlpha");
            double windowAlpha  = RegeditRW.RegRead("WindowAlpha");
            //窗口大小
            double mainWindowHeight = RegeditRW.RegRead("MainWindowHeight");
            double mainWindowWidth  = RegeditRW.RegRead("MainWindowWidth");
            //字体
            string mainWindowFont = RegeditRW.RegReadString("MainWindowFont");
            //设置菜单
            double winTopmost = RegeditRW.RegRead("Topmost");
            //游戏版本
            double gameVersion = RegeditRW.RegRead("GameVersion");
            #endregion
            //初始化
            InitializeComponent();
            //窗口缩放
            SourceInitialized += delegate(object sender, EventArgs e) { _HwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource; };
            MouseMove         += new System.Windows.Input.MouseEventHandler(Window_MouseMove);
            //mainWindow初始化标志
            MWInit = true;
            #region "读取设置"
            //设置字体
            if (mainWindowFont == "" || mainWindowFont == null)
            {
                RegeditRW.RegWrite("MainWindowFont", "微软雅黑");
                mainWindowFont = "微软雅黑";
            }
            mainWindow.FontFamily = new FontFamily(mainWindowFont);
            //版本初始化
            UI_Version.Text = "v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            //窗口可视化计时器
            VisiTimer.Enabled  = true;
            VisiTimer.Interval = 200;
            VisiTimer.Tick    += new EventHandler(VisiTimerEvent);
            VisiTimer.Start();
            //设置光标资源字典路径
            cursorDictionary.Source = new Uri("Dictionary/CursorDictionary.xaml", UriKind.Relative);
            //显示窗口
            MWVisivility = true;
            //右侧面板Visibility属性初始化
            RightPanelVisibility("Welcome");

            //窗口置顶
            if (winTopmost == 1)
            {
                Se_button_Topmost_Click(null, null);
            }
            //设置背景
            if (bg == "")
            {
                Se_BG_Alpha_Text.Foreground = Brushes.Silver;
                Se_BG_Alpha.IsEnabled       = false;
            }
            else
            {
                Se_BG_Alpha_Text.Foreground = Brushes.Black;
                try
                {
                    var brush = new ImageBrush()
                    {
                        ImageSource = new BitmapImage(new Uri(bg))
                    };
                    UI_BackGroundBorder.Background = brush;
                }
                catch
                {
                    Visi.VisiCol(true, UI_BackGroundBorder);
                }
            }
            //设置背景拉伸方式
            if (bgStretch == 0)
            {
                bgStretch = 2;
            }
            Se_ComboBox_Background_Stretch.SelectedIndex = (int)bgStretch - 1;
            //设置背景透明度
            if (bgAlpha == 0)
            {
                bgAlpha = 101;
            }
            Se_BG_Alpha.Value           = bgAlpha - 1;
            Se_BG_Alpha_Text.Text       = "背景不透明度:" + (int)Se_BG_Alpha.Value + "%";
            UI_BackGroundBorder.Opacity = (bgAlpha - 1) / 100;
            //设置面板透明度
            if (bgPanelAlpha == 0)
            {
                bgPanelAlpha = 61;
            }
            Se_Panel_Alpha.Value         = bgPanelAlpha - 1;
            Se_Panel_Alpha_Text.Text     = "面板不透明度:" + (int)Se_Panel_Alpha.Value + "%";
            RightGrid.Background.Opacity = (bgPanelAlpha - 1) / 100;
            //设置窗口透明度
            if (windowAlpha == 0)
            {
                windowAlpha = 101;
            }
            Se_Window_Alpha.Value     = windowAlpha - 1;
            Se_Window_Alpha_Text.Text = "窗口不透明度:" + (int)Se_Window_Alpha.Value + "%";
            Opacity = (windowAlpha - 1) / 100;
            //设置高度和宽度
            Width  = mainWindowWidth;
            Height = mainWindowHeight;
            //设置游戏版本
            UI_gameversion.SelectedIndex = (int)gameVersion;
            #endregion
        }