Example #1
0
        void queueDownloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            this.Width = Application.Current.Host.Content.ActualWidth;
            this.Height = Application.Current.Host.Content.ActualHeight;

            ImageButton faceList = new ImageButton() {
                TotalWidth = 162,
                TotalHeight = 27,
                Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/18.png", UriType.Web), Stretch = Stretch.None },
                Text = GetLanguagePackContent(42),
                TextStyle = Application.Current.Resources["TextStyle5"] as Style,
                TextHasEffect = false,
                TextBrush = new SolidColorBrush(Colors.Black),
            };
            this.Children.Add(faceList);
            Canvas.SetLeft(faceList, 15);
            Canvas.SetTop(faceList, 85);

            for (int i = 0; i < roleMax; i++) {
                roleList[i] = new ImageButton() {
                    Tag = "",
                    TotalWidth = 168,
                    TotalHeight = 54,
                    Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/4.png", UriType.Web), Stretch = Stretch.None },
                    TextStyle = Application.Current.Resources["TextStyle6"] as Style,
                    TextHasEffect = true,
                    TextEffectColor = Colors.Red,
                    TextBrush = new SolidColorBrush(Colors.White),
                    TextHoverBrush = new SolidColorBrush(Colors.Yellow),
                };
                this.Children.Add(roleList[i]);
                Canvas.SetLeft(roleList[i], 10);
                Canvas.SetTop(roleList[i], 120 + 56 * i);
                Canvas.SetZIndex(roleList[i], 3);
                roleList[0].Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/20.png", UriType.Web) };
                roleList[i].Click += (s1, e1) => {
                    ImageButton obj = s1 as ImageButton;
                    if (obj.Tag.ToString().Equals("")) { return; }
                    for (int j = 0; j <= roleList.GetUpperBound(0); j++) {
                        roleList[j].TextBrush = new SolidColorBrush(Colors.White);
                        roleList[j].Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/4.png", UriType.Web), };
                    }
                    obj.TextBrush = new SolidColorBrush(Color.FromArgb(255, 172, 255, 140));
                    obj.Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/20.png", UriType.Web), };

                    LoginManager.RoleName = obj.Tag.ToString();
                    ChangeRole(roles.Single(X => X.RoleName == LoginManager.RoleName));
                };
            }
            roleList[0].TextBrush = new SolidColorBrush(Color.FromArgb(255, 172, 255, 140));

            aura = new AnimationBase() { Code = 71, Loop = true, IsHitTestVisible = false, Position =new Point(258,380)  };
            this.Children.Add(aura);
            aura.HeartStart();

            this.Children.Add(roleModel);
            Canvas.SetLeft(roleModel, 220);
            Canvas.SetTop(roleModel, 100);

            Image roleData = new Image() { Source = GlobalMethod.GetImage("UI/19.png", UriType.Web), };
            this.Children.Add(roleData);
            Canvas.SetLeft(roleData, 582);
            Canvas.SetTop(roleData, 40);

            this.Children.Add(avatar);
            Canvas.SetLeft(avatar, 654);
            Canvas.SetTop(avatar, 70);

            TextBlock text0 = new TextBlock() { Text = GetLanguagePackContent(43), Style = Application.Current.Resources["TextStyle7"] as Style };
            TextBlock text1 = new TextBlock() { Text = GetLanguagePackContent(44), Style = Application.Current.Resources["TextStyle7"] as Style };
            TextBlock text2 = new TextBlock() { Text = GetLanguagePackContent(45), Style = Application.Current.Resources["TextStyle7"] as Style };
            TextBlock text3 = new TextBlock() { Text = GetLanguagePackContent(46), Style = Application.Current.Resources["TextStyle7"] as Style };
            TextBlock text4 = new TextBlock() { Text = GetLanguagePackContent(47), Style = Application.Current.Resources["TextStyle7"] as Style };
            TextBlock text5 = new TextBlock() { Text = GetLanguagePackContent(48), Style = Application.Current.Resources["TextStyle7"] as Style };
            TextBlock text6 = new TextBlock() { Text = GetLanguagePackContent(49), Style = Application.Current.Resources["TextStyle7"] as Style };
            this.Children.Add(text0); Canvas.SetLeft(text0, 680); Canvas.SetTop(text0, 158);
            this.Children.Add(text1); Canvas.SetLeft(text1, 645); Canvas.SetTop(text1, 192);
            this.Children.Add(text2); Canvas.SetLeft(text2, 714); Canvas.SetTop(text2, 192);
            this.Children.Add(text3); Canvas.SetLeft(text3, 680); Canvas.SetTop(text3, 226);
            this.Children.Add(text4); Canvas.SetLeft(text4, 680); Canvas.SetTop(text4, 258);
            this.Children.Add(text5); Canvas.SetLeft(text5, 670); Canvas.SetTop(text5, 292);
            this.Children.Add(text6); Canvas.SetLeft(text6, 658); Canvas.SetTop(text6, 326);

            Grid grid0 = new Grid() { Width = 130 }; this.Children.Add(grid0); Canvas.SetLeft(grid0, 626); Canvas.SetTop(grid0, 173);
            Grid grid1 = new Grid() { Width = 60 }; this.Children.Add(grid1); Canvas.SetLeft(grid1, 626); Canvas.SetTop(grid1, 207);
            Grid grid2 = new Grid() { Width = 60 }; this.Children.Add(grid2); Canvas.SetLeft(grid2, 694); Canvas.SetTop(grid2, 207);
            Grid grid3 = new Grid() { Width = 130 }; this.Children.Add(grid3); Canvas.SetLeft(grid3, 626); Canvas.SetTop(grid3, 241);
            Grid grid4 = new Grid() { Width = 130 }; this.Children.Add(grid4); Canvas.SetLeft(grid4, 626); Canvas.SetTop(grid4, 273);
            Grid grid5 = new Grid() { Width = 130 }; this.Children.Add(grid5); Canvas.SetLeft(grid5, 626); Canvas.SetTop(grid5, 307);
            Grid grid6 = new Grid() { Width = 130 }; this.Children.Add(grid6); Canvas.SetLeft(grid6, 626); Canvas.SetTop(grid6, 341);
            roleName = new TextBlock() { Style = Application.Current.Resources["TextStyle8"] as Style };
            occupation = new TextBlock() { Style = Application.Current.Resources["TextStyle8"] as Style };
            level = new TextBlock() { Style = Application.Current.Resources["TextStyle8"] as Style };
            experience = new TextBlock() { Style = Application.Current.Resources["TextStyle8"] as Style };
            map = new TextBlock() { Style = Application.Current.Resources["TextStyle8"] as Style };
            time = new TextBlock() { Style = Application.Current.Resources["TextStyle8"] as Style };
            ip = new TextBlock() { Style = Application.Current.Resources["TextStyle8"] as Style };
            grid0.Children.Add(roleName);
            grid1.Children.Add(occupation);
            grid2.Children.Add(level);
            grid3.Children.Add(experience);
            grid4.Children.Add(map);
            grid5.Children.Add(time);
            grid6.Children.Add(ip);

            ImageButton startGame = new ImageButton() {
                TotalWidth = 80,
                TotalHeight = 25,
                Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/3.png", UriType.Web), Stretch = Stretch.None },
                Text = GetLanguagePackContent(50),
                TextStyle = Application.Current.Resources["TextStyle1"] as Style,
                TextHasEffect = true,
                TextEffectColor = Colors.Black,
                TextBrush = new SolidColorBrush(Color.FromArgb(255, 48, 83, 96)),
                TextHoverBrush = new SolidColorBrush(Colors.White),
            };
            startGame.Click += (s1, e1) => {
                Dispose(this,null);
                if (GameStart != null) { GameStart(this, e1); }
            };
            ImageButton cannel = new ImageButton() {
                TotalWidth = 80,
                TotalHeight = 25,
                Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/3.png", UriType.Web), Stretch = Stretch.None },
                Text = GetLanguagePackContent(51),
                TextStyle = Application.Current.Resources["TextStyle1"] as Style,
                TextHasEffect = true,
                TextEffectColor = Colors.Black,
                TextBrush = new SolidColorBrush(Color.FromArgb(255, 48, 83, 96)),
                TextHoverBrush = new SolidColorBrush(Colors.White),
            };
            cannel.Click += (s1, e1) => {
                Dispose(this, null);
                if (Cannel != null) { Cannel(this, e1); }
            };
            ImageButton newRole = new ImageButton() {
                TotalWidth = 80,
                TotalHeight = 25,
                Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/3.png", UriType.Web), Stretch = Stretch.None },
                Text = GetLanguagePackContent(52),
                TextStyle = Application.Current.Resources["TextStyle1"] as Style,
                TextHasEffect = true,
                TextEffectColor = Colors.Black,
                TextBrush = new SolidColorBrush(Color.FromArgb(255, 48, 83, 96)),
                TextHoverBrush = new SolidColorBrush(Colors.White),
            };
            newRole.Click += (s1, e1) => {
                LoginManager.loading.Show();
                WCFServiceClient wcf1 = new WCFServiceClient();
                wcf1.GetUserRoleNumAsync(LoginManager.UserName);
                wcf1.GetUserRoleNumCompleted += (s2, e2) => {
                    if (e2.Result == 6) {
                        LoginManager.loginTip.Show(GetLanguagePackContent(53), LoginTipMode.TipOnly);
                        LoginManager.loading.Hide();
                    } else {
                        Dispose(this, null);
                        if (CreateRole != null) { CreateRole(this, e1); }
                    }
                    wcf1.CloseAsync();
                };
            };
            delRole = new ImageButton() {
                TotalWidth = 80,
                TotalHeight = 25,
                Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/3.png", UriType.Web), Stretch = Stretch.None },
                Text = GetLanguagePackContent(54),
                TextStyle = Application.Current.Resources["TextStyle1"] as Style,
                TextHasEffect = true,
                TextEffectColor = Colors.Black,
                TextBrush = new SolidColorBrush(Color.FromArgb(255, 48, 83, 96)),
                TextHoverBrush = new SolidColorBrush(Colors.White),
            };
            delRole.Click += (s1, e1) => {
                if (roles.Count() == 0) { return; }
                LoginManager.loginTip.Show(GetLanguagePackContent(59), LoginTipMode.ConfirmOrCannel);
                LoginManager.loginTip.OK += new MouseButtonEventHandler(dialog_OK);
            };
            this.Children.Add(startGame); Canvas.SetLeft(startGame, 650); Canvas.SetTop(startGame, 380);
            this.Children.Add(cannel); Canvas.SetLeft(cannel, 650); Canvas.SetTop(cannel, 415);
            this.Children.Add(newRole); Canvas.SetLeft(newRole, 650); Canvas.SetTop(newRole, 450);
            this.Children.Add(delRole); Canvas.SetLeft(delRole, 650); Canvas.SetTop(delRole, 485);

            base.OnResourceReady(this, e);
            LoadRoles(LoginManager.UserName);
        }
Example #2
0
        void queueDownloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            this.Width = 910;
            this.Height = 590;

            ImageButton faceList = new ImageButton() {
                TotalWidth = 162,
                TotalHeight = 27,
                Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/18.png", UriType.Web), Stretch = Stretch.None },
                Text = GetLanguagePackContent(25),
                TextStyle = Application.Current.Resources["TextStyle5"] as Style,
                TextHasEffect = false,
                TextBrush = new SolidColorBrush(Colors.Black),
            };
            this.Children.Add(faceList);
            Canvas.SetLeft(faceList, 0);
            Canvas.SetTop(faceList, 85);

            avatarSelector = new AnimationBase() { Code = 70, Loop = true, Z = 10, IsHitTestVisible = false };
            this.Children.Add(avatarSelector);
            avatarSelector.HeartStart();

            for (int i = 0; i <= avatar.GetUpperBound(0); i++) {
                avatar[i] = new ImageButton() {
                    Code = i,
                    TotalWidth = 74,
                    TotalHeight = 74,
                    BodyHasEffect = true,
                    BodyEffectColor = Colors.Blue,
                };
                this.Children.Add(avatar[i]);
                Canvas.SetLeft(avatar[i], 40);
                Canvas.SetTop(avatar[i], 130 + i * 85);
                Canvas.SetZIndex(avatar[i], 3);
                avatar[i].MouseLeftButtonDown += (s1, e1) => {
                    ImageButton obj =s1 as ImageButton;
                    faceCode = obj.Code;
                    avatarSelector.Visibility = Visibility.Visible;
                    avatarSelector.IsVisible = true;
                    avatarSelector.Position = obj.Position;
                };
            }
            ShowSexFace(Sex.male);
            avatarSelector.Position = avatar[0].Position;

            light = new AnimationBase { Code = 72, Loop = true, Z = 4, IsHitTestVisible = false };
            this.Children.Add(light);
            light.HeartStart();
            light.Position = new Point(190, 75);

            this.Children.Add(maleModel);
            Canvas.SetLeft(maleModel, 80);
            Canvas.SetTop(maleModel, 120);
            maleModel.MouseLeftButtonDown += (s1, e1) => {
                //waiting.Show(); Canvas.SetLeft(waiting, -400); Canvas.SetTop(waiting, 100);
                ShowSexFace(Sex.male);
                ShowRoleModel(profession, Sex.male);
                light.Position = new Point(190, 75);
            };
            this.Children.Add(femaleModel);
            Canvas.SetLeft(femaleModel, 270);
            Canvas.SetTop(femaleModel, 120);
            ShowRoleModel(profession, Sex.male);
            femaleModel.MouseLeftButtonDown += (s1, e1) => {
                //waiting.Show(); Canvas.SetLeft(waiting, -200); Canvas.SetTop(waiting, 100);
                ShowSexFace(Sex.female);
                ShowRoleModel(profession, Sex.female);
                light.Position = new Point(385, 75);
            };

            for (int i = 0; i <= professionSelector.GetUpperBound(0); i++) {
                professionSelector[i] = new ImageButton() {
                    Tag = i,
                    TotalWidth = 153,
                    TotalHeight = 32,
                    Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/5.png", UriType.Web), Stretch = Stretch.None },
                    TextStyle = Application.Current.Resources["TextStyle3"] as Style,
                    TextHasEffect = true,
                    TextEffectColor = Colors.Red,
                    TextBrush = new SolidColorBrush(Colors.White),
                    TextHoverBrush = new SolidColorBrush(Colors.Yellow),
                    Z  = 3,
                };
                this.Children.Add(professionSelector[i]);
                professionSelector[i].Position = new Point(600, 70 + 50 * i);
                professionSelector[0].Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/9.png", UriType.Web) };
                professionSelector[i].Click += (s1, e1) => {
                    for (int j = 0; j <= professionSelector.GetUpperBound(0); j++) {
                        professionSelector[j].Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/5.png", UriType.Web) };
                    }
                    ImageButton obj = s1 as ImageButton;
                    obj.Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/9.png", UriType.Web) };
                    ShowRoleModel((Professions)obj.Tag, sex);
                };
            }
            professionSelector[0].Text = GetLanguagePackContent(28);
            professionSelector[1].Text = GetLanguagePackContent(27);
            professionSelector[2].Text = GetLanguagePackContent(26);
            professionSelector[3].Text = GetLanguagePackContent(29);

            Image descriptionHead = new Image() { Source = GlobalMethod.GetImage("UI/6.png", UriType.Web) };
            Grid descriptionBody = new Grid() {
                Width = 221,
                Height = 220,
                Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/7.png", UriType.Web) }
            };
            descriptionBody.Children.Add(description);
            Image descriptionFoot = new Image() { Source = GlobalMethod.GetImage("UI/8.png", UriType.Web) };
            this.Children.Add(descriptionHead);
            this.Children.Add(descriptionFoot);
            this.Children.Add(descriptionBody);
            Canvas.SetLeft(descriptionHead, 570);
            Canvas.SetTop(descriptionHead, 280);
            Canvas.SetLeft(descriptionBody, 570);
            Canvas.SetTop(descriptionBody, 285);
            Canvas.SetLeft(descriptionFoot, 570);
            Canvas.SetTop(descriptionFoot, 455);

            TextBlock text0 = new TextBlock() { Text = GetLanguagePackContent(30), Foreground = new SolidColorBrush(Colors.White), FontSize = 18, FontWeight = FontWeights.SemiBold };
            this.Children.Add(text0);
            Canvas.SetLeft(text0, 200);
            Canvas.SetTop(text0, 545);
            TextBox roleName = new TextBox() { Width = 240, Background = new SolidColorBrush(Color.FromArgb(255, 57, 57, 57)), Style = Application.Current.Resources["TextStyle2"] as Style };
            this.Children.Add(roleName);
            Canvas.SetLeft(roleName, 285);
            Canvas.SetTop(roleName, 548);

            ImageButton createRole = new ImageButton() {
                TotalWidth = 80,
                TotalHeight = 25,
                Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/3.png", UriType.Web), Stretch = Stretch.None },
                Text = GetLanguagePackContent(31),
                TextStyle = Application.Current.Resources["TextStyle1"] as Style,
                TextHasEffect = true,
                TextEffectColor = Colors.Black,
                TextBrush = new SolidColorBrush(Color.FromArgb(255, 48, 83, 96)),
                TextHoverBrush = new SolidColorBrush(Colors.White),
            };
            this.Children.Add(createRole);
            Canvas.SetLeft(createRole, 550);
            Canvas.SetTop(createRole, 547);
            //创建角色
            createRole.MouseLeftButtonDown += (s1, e1) => {
                if (roleName.Text.Trim().Equals("") || roleName.Text.Trim().Length > 20) { LoginManager.loginTip.Show(GetLanguagePackContent(40), LoginTipMode.TipOnly); return; }
                LoginManager.loading.Show();
                WCFServiceClient wcfServiceClient = new WCFServiceClient();
                wcfServiceClient.CheckRoleExistAsync(roleName.Text.Trim());
                wcfServiceClient.CheckRoleExistCompleted += (s2, e2) => {
                    if (e2.Result == 0) {
                        wcfServiceClient.InsertRoleAsync(LoginManager.UserName, roleName.Text.Trim(), (byte)faceCode, (byte)sex, (byte)profession, 1, 0, 1, Application.Current.Host.InitParams["ClientIP"], "");
                        wcfServiceClient.InsertRoleCompleted += (s3, e3) => {
                            LoginManager.loading.Hide();
                            if (e3.Result != 0) {
                                LoginManager.loginTip.Show(string.Format("{0} {1}", roleName.Text.Trim(), GetLanguagePackContent(58)), LoginTipMode.TipOnly);
                                MouseButtonEventHandler handler = null;
                                LoginManager.loginTip.OK += handler = delegate {
                                    LoginManager.loginTip.OK -= handler;
                                    Dispose(this, null);
                                    if (RoleCreated != null) { RoleCreated(this, null); }
                                };
                                e1.Handled = true;
                            } else {
                                LoginManager.loginTip.Show(GetLanguagePackContent(38), LoginTipMode.TipOnly);
                            }
                        };
                    } else {
                        LoginManager.loading.Hide();
                        LoginManager.loginTip.Show(GetLanguagePackContent(39), LoginTipMode.TipOnly);
                    }
                    wcfServiceClient.CloseAsync();
                };
            };
            ImageButton cannel = new ImageButton() {
                TotalWidth = 80,
                TotalHeight = 25,
                Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/3.png", UriType.Web), Stretch = Stretch.None },
                Text = GetLanguagePackContent(51),
                TextStyle = Application.Current.Resources["TextStyle1"] as Style,
                TextHasEffect = true,
                TextEffectColor = Colors.Black,
                TextBrush = new SolidColorBrush(Color.FromArgb(255, 48, 83, 96)),
                TextHoverBrush = new SolidColorBrush(Colors.White),
            };
            this.Children.Add(cannel);
            Canvas.SetLeft(cannel, 650);
            Canvas.SetTop(cannel, 547);
            cannel.Click += (s1, e1) => {
                Dispose(this, null);
                if (Cannel != null) {  Cannel(this, e1); }
            };
            base.OnResourceReady(this, e);
        }
 void queueDownloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
 {
     QueueParallelDownloader queueDownloader = sender as QueueParallelDownloader;
     queueDownloader.DownloadCompleted -= queueDownloader_OpenReadCompleted;
     Canvas body = new Canvas() {
         Width = 255,
         Height = 200,
         Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/105.png", UriType.Web) }
     };
     RadioButton[] languages = new RadioButton[5];
     languages[0] = new RadioButton() {
         Tag = "zh-cn",
         Content = new TextBlock() {
             Text = "简体中文",
             Style = Application.Current.Resources["TextStyle0"] as Style,
             TextWrapping = TextWrapping.Wrap,
             Foreground = new SolidColorBrush(Color.FromArgb(255, 239, 255, 208)),
         },
         FontSize = 14,
         GroupName = "Language",
         IsChecked = true,
     };
     languages[1] = new RadioButton() {
         Tag = "zh-tw",
         Content = new TextBlock() {
             Text = "繁體中文",
             Style = Application.Current.Resources["TextStyle0"] as Style,
             TextWrapping = TextWrapping.Wrap,
             Foreground = new SolidColorBrush(Color.FromArgb(255, 239, 255, 208)),
         },
         FontSize = 14,
         GroupName = "Language",
     };
     languages[2] = new RadioButton() {
         Tag = "us",
         Content = new TextBlock() {
             Text = "English",
             Style = Application.Current.Resources["TextStyle0"] as Style,
             TextWrapping = TextWrapping.Wrap,
             Foreground = new SolidColorBrush(Color.FromArgb(255, 239, 255, 208)),
         },
         FontSize = 14,
         GroupName = "Language"
     };
     languages[3] = new RadioButton() {
         Tag = "jp",
         Content = new TextBlock() {
             Text = "日本語",
             Style = Application.Current.Resources["TextStyle0"] as Style,
             TextWrapping = TextWrapping.Wrap,
             Foreground = new SolidColorBrush(Color.FromArgb(255, 239, 255, 208)),
         },
         FontSize = 14,
         GroupName = "Language"
     };
     languages[4] = new RadioButton() {
         Tag = "kr",
         Content = new TextBlock() {
             Text = "한국의",
             Style = Application.Current.Resources["TextStyle0"] as Style,
             TextWrapping = TextWrapping.Wrap,
             Foreground = new SolidColorBrush(Color.FromArgb(255, 239, 255, 208)),
         },
         FontSize = 14,
         GroupName = "Language"
     };
     for (int i = 0; i <= languages.GetUpperBound(0); i++) {
         body.Children.Add(languages[i]);
         Canvas.SetLeft(languages[i], 86); Canvas.SetTop(languages[i], -5 + i * 35);
     }
     ImageButton closer = new ImageButton() {
         TotalWidth = 93,
         TotalHeight = 27,
         Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/106.png", UriType.Web), Stretch = Stretch.None },
         Text = "提交(OK)",
         TextStyle = Application.Current.Resources["TextStyle1"] as Style,
         TextSize = 14,
         TextHasEffect = true,
         TextEffectColor = Colors.Black,
         TextBrush = new SolidColorBrush(Colors.LightGray),
         TextHoverBrush = new SolidColorBrush(Colors.White),
     };
     body.Children.Add(closer); Canvas.SetLeft(closer, 73); Canvas.SetTop(closer, 167);
     MouseButtonEventHandler handler0 = null;
     closer.Click += handler0 = delegate {
         closer.Click -= handler0;
         for (int i = 0; i <= languages.GetUpperBound(0); i++) {
             if (languages[i].IsChecked.Value) {
                 ParallelDownloader downloader = new ParallelDownloader();
                 OpenReadCompletedEventHandler handler = null;
                 downloader.OpenReadCompleted += handler = (s2, e2) => {
                     downloader.OpenReadCompleted -= handler;
                     Infos["Language"] = XElement.Load(e2.Result as Stream);
                     if (Submit != null) { Submit(this, null); }
                 };
                 downloader.OpenReadAsync(string.Format(GlobalMethod.WebPath("Language/{0}.xml"), languages[i].Tag.ToString()), DownloadPriority.Highest, null, false, 0);
                 break;
             }
         }
     };
     StyleBox styleBox = new StyleBox() {
         HeadHeight = 60,
         BodyHeight = 200,
         FootHeight = 15,
         NorthCenterWidth = 75,
         CenterWidth = 255,
         CenterEdgeWidth = 30,
         SouthCenterWidth = 229,
         NorthEdgeImageSource = GlobalMethod.GetImage("UI/100.png", UriType.Web),
         NorthImageSource = GlobalMethod.GetImage("UI/101.png", UriType.Web),
         CenterEdgeImageSource = GlobalMethod.GetImage("UI/102.png", UriType.Web),
         SouthEdgeImageSource = GlobalMethod.GetImage("UI/103.png", UriType.Web),
         SouthImageSource = GlobalMethod.GetImage("UI/104.png", UriType.Web),
         CenterContent = body,
     };
     styleBox.HeadText.Foreground = new SolidColorBrush(Colors.White);
     styleBox.HeadText.Text = "选 择 语 言";
     styleBox.HeadText.FontSize = 14;
     styleBox.HeadText.Margin = new Thickness(0, -20, 0, 0);
     Body = styleBox;
     base.OnResourceReady(this, e);
 }
Example #4
0
 public LoginTip()
 {
     //this.CacheMode = null; //不这样居然就会出现缝隙??晕,这个GPU太牛了
     confirm = new ImageButton() {
         TotalWidth = 93,
         TotalHeight = 27,
         Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/106.png", UriType.Web), Stretch = Stretch.None },
         Text = GetLanguagePackContent(2),
         TextStyle = Application.Current.Resources["TextStyle1"] as Style,
         TextSize = 14,
         TextHasEffect = true,
         TextEffectColor = Colors.Black,
         TextBrush = new SolidColorBrush(Colors.LightGray),
         TextHoverBrush = new SolidColorBrush(Colors.White),
     };
     confirm.Click += (s1, e1) => {
         base.Hide();
         if (OK != null) { OK(this, e1); }
     };
     cannel = new ImageButton() {
         TotalWidth = 93,
         TotalHeight = 27,
         Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/106.png", UriType.Web), Stretch = Stretch.None },
         Text = GetLanguagePackContent(57),
         TextStyle = Application.Current.Resources["TextStyle1"] as Style,
         TextSize = 14,
         TextHasEffect = true,
         TextEffectColor = Colors.Black,
         TextBrush = new SolidColorBrush(Colors.LightGray),
         TextHoverBrush = new SolidColorBrush(Colors.White),
         Visibility = Visibility.Collapsed,
     };
     cannel.Click += (s1, e1) => {
         base.Hide();
         if (Cannel != null) { Cannel(this, e1); }
     };
     Grid grid = new Grid() { Width = 240, Height = 102,Background = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/105.png", UriType.Web) } };
     styleBox = new StyleBox() {
         HeadHeight = 60,
         BodyHeight = 100,
         FootHeight = 15,
         NorthCenterWidth = 60,
         CenterWidth = 240,
         CenterEdgeWidth = 30,
         SouthCenterWidth = 214,
         NorthEdgeImageSource = GlobalMethod.GetImage("UI/100.png", UriType.Web),
         NorthImageSource = GlobalMethod.GetImage("UI/101.png", UriType.Web),
         CenterEdgeImageSource = GlobalMethod.GetImage("UI/102.png", UriType.Web),
         SouthEdgeImageSource = GlobalMethod.GetImage("UI/103.png", UriType.Web),
         SouthImageSource = GlobalMethod.GetImage("UI/104.png", UriType.Web),
         CenterContent = grid,
     };
     styleBox.HeadText.Foreground = new SolidColorBrush(Colors.White);
     styleBox.HeadText.Text = GetLanguagePackContent(61);
     styleBox.HeadText.FontSize = 14;
     styleBox.HeadText.Margin = new Thickness(0, -20, 0, 0);
     styleBox.Children.Add(input); Canvas.SetLeft(input, 55); Canvas.SetTop(input, 83);
     styleBox.Children.Add(confirm);
     styleBox.Children.Add(cannel); Canvas.SetLeft(cannel, 160); Canvas.SetTop(cannel, 127);
     grid.Children.Add(content);
     content.Margin = new Thickness(5, -40, 5, 0);
     this.Content = styleBox;
     base.OnResourceReady(this, null);
 }