Esempio n. 1
0
        //Вывод новостей

        private void Launcher_NewsLoadStateChanged(object sender, LoadTextEventArgs e)
        {
            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                hotNewsTextBox.Text = "Getting data...";
                break;

            case LoadingState.Completed:
                if (e.Result.Success)
                {
                    hotNewsTextBox.Text = e.Result.Data;
                    SetVisibilityToHotNewsBlock(true);
                }
                else
                {
                    hotNewsTextBox.Text = string.Empty;
                    SetVisibilityToHotNewsBlock(false);
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 2
0
        //Вывод новостей
        private void Launcher_NewsLoadBanner(object sender, LoadTextEventArgs e)
        {
            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                break;

            case LoadingState.Completed:
                bannersLoader.Visibility = Visibility.Visible;
                bannersFrame.Visibility  = Visibility.Visible;
                try
                {
                    if (e.Result.Success)
                    {
                        ExpressNewsSet newsSet = ExpressNewsSet.FromXml(e.Result.Data);
                        bannersLoader.NewsItems = newsSet.ExpressNews;
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show("It is not possible to connect to the news server. Please restart the program. If the error persists, again, please contact technical support project");
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 3
0
        //Загружаем все, что касается статистики персонажа через XML
        private void Launcher_OnStatOnline(object sender, LoadTextEventArgs e)
        {
            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                StartWaitAnimation();
                break;

            case LoadingState.Completed:
                StopWaitAnimation();
                try
                {
                    if (e.Result.Success)
                    {
                        StatisticSet statSet = StatisticSet.FromXml(e.Result.Data);
                        charList.ItemsSource = statSet.Stat;
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show("Not possible to generate a list of characters. Please restart the program. If the error persists, again, please contact technical support project");
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 4
0
        //Загружаем все, что касается информации персонажа через XML
        private void Launcher_OnShowPlayerInfo(object sender, LoadTextEventArgs e)
        {
            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                //StartWaitAnimation();
                break;

            case LoadingState.Completed:
                //StopWaitAnimation();
                try
                {
                    if (e.Result.Success)
                    {
                        PlayerInfoSet playerSet = PlayerInfoSet.FromXml(e.Result.Data);     // player info
                        charInfoBox.ItemsSource = playerSet.Stat;
                        // получаем имг сорц как урл
                        ImagePath = playerSet.Stat.First(x => x.Name == CharName).Race;
                        BitmapImage bimage = new BitmapImage();
                        bimage.BeginInit();
                        bimage.UriSource = new Uri(ImagePath, UriKind.Relative);
                        bimage.EndInit();
                        bgCharInfo.Source = bimage;
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show(
                        "Not possible to generate a character info. Please restart the program. If the error persists, again, please contact technical support project");
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        //Вывод новостей реалм 1
        private void Launcher_NewsLoadBanner(object sender, LoadTextEventArgs e)
        {
            ResourceProvider resource = ResourceProvider.Instance;

            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                StartWaitAnimation();
                break;

            case LoadingState.Completed:
                bannersLoader.Visibility = Visibility.Visible;
                try
                {
                    if (e.Result.Success)
                    {
                        ExpressNewsSet newsSet = ExpressNewsSet.FromXml(e.Result.Data);
                        bannersLoader.NewsItems = newsSet.ExpressNews;
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                    FancyBalloon balloon = new FancyBalloon();
                    balloon.BalloonMessage = resource.Get(TextResource.NEWSBANNERERROR);
                    tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);

                    Logger.Current.AppendException(err);
                }
                StopWaitAnimation();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private void Launcher_NewsLoadStateChanged(object sender, LoadTextEventArgs e)
        {
            string rootDirectory = _xmlhelper.GetSettingValue("realm1_client_location");

            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                StartWaitAnimation();
                break;

            case LoadingState.Completed:
                if (e.Result.Success)
                {
                    if (rootDirectory == "")
                    {
                        SetVisibilityToHotNewsBlock(false);
                    }
                    else
                    {
                        hotNewsTextBox.Text = e.Result.Data;
                        SetVisibilityToHotNewsBlock(true);
                    }
                }
                else
                {
                    hotNewsTextBox.Text = string.Empty;
                    SetVisibilityToHotNewsBlock(false);
                }
                StopWaitAnimation();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 7
0
        private void Launcher_NewsLoadBanner(object sender, LoadTextEventArgs e)
        {
            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                charList.Visibility = Visibility.Hidden;
                StartWaitAnimation();
                break;

            case LoadingState.Completed:
                try
                {
                    if (e.Result.Success)
                    {
                        ExpressNewsSet newsSet = ExpressNewsSet.FromXml(e.Result.Data);
                        newsSet.Update(_newsKeys);
                        News = newsSet.ExpressNews;
                        charList.ItemsSource   = newsSet.ExpressNews;
                        charList.SelectedIndex = 0;
                    }
                }
                catch (Exception err)
                {
                    Logger.Current.AppendException(err);
                }
                StopWaitAnimation();
                charList.Visibility = Visibility.Visible;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 8
0
        //Загружаем все, что касается информации персонажа через XML

        //Загружаем все, что касается информации об вещах через XML
        private void Launcher_OnPlayerImage(object sender, LoadTextEventArgs e)
        {
            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                StartWaitAnimation();
                break;

            case LoadingState.Completed:
                StopWaitAnimation();

                try
                {
                    if (e.Result.Success)
                    {
                        PlayerItemSet imageInfo = PlayerItemSet.FromXml(e.Result.Data);     // item image


                        // получаем имг сорц как урл
                        var player = imageInfo.Stat[0];
                        Slot0  = player.HeadChar;
                        Slot1  = player.Neck;
                        Slot2  = player.Shoulders;
                        Slot3  = player.BodyChar;
                        Slot4  = player.ChestChar;
                        Slot5  = player.Waist;
                        Slot6  = player.Legs;
                        Slot7  = player.Feet;
                        Slot8  = player.Wrists;
                        Slot9  = player.Hands;
                        Slot10 = player.Finger1;
                        Slot11 = player.Finger2;
                        Slot12 = player.Trinket1;
                        Slot13 = player.Trinket2;
                        Slot14 = player.Back;
                        Slot15 = player.MainHand;
                        Slot16 = player.OffHand;
                        Slot17 = player.Ranget;
                        Slot18 = player.Tabard;

                        BitmapImage img0 = new BitmapImage();
                        img0.BeginInit();
                        img0.UriSource = new Uri(Slot0, UriKind.Absolute);
                        img0.EndInit();
                        s0.Source = img0;

                        BitmapImage img1 = new BitmapImage();
                        img1.BeginInit();
                        img1.UriSource = new Uri(Slot1, UriKind.Absolute);
                        img1.EndInit();
                        s1.Source = img1;

                        BitmapImage img2 = new BitmapImage();
                        img2.BeginInit();
                        img2.UriSource = new Uri(Slot2, UriKind.Absolute);
                        img2.EndInit();
                        s2.Source = img2;

                        BitmapImage img3 = new BitmapImage();
                        img3.BeginInit();
                        img3.UriSource = new Uri(Slot3, UriKind.Absolute);
                        img3.EndInit();
                        s3.Source = img3;

                        BitmapImage img4 = new BitmapImage();
                        img4.BeginInit();
                        img4.UriSource = new Uri(Slot4, UriKind.Absolute);
                        img4.EndInit();
                        s4.Source = img4;

                        BitmapImage img5 = new BitmapImage();
                        img5.BeginInit();
                        img5.UriSource = new Uri(Slot5, UriKind.Absolute);
                        img5.EndInit();
                        s5.Source = img5;

                        BitmapImage img6 = new BitmapImage();
                        img6.BeginInit();
                        img6.UriSource = new Uri(Slot6, UriKind.Absolute);
                        img6.EndInit();
                        s6.Source = img6;

                        BitmapImage img7 = new BitmapImage();
                        img7.BeginInit();
                        img7.UriSource = new Uri(Slot7, UriKind.Absolute);
                        img7.EndInit();
                        s7.Source = img7;

                        BitmapImage img8 = new BitmapImage();
                        img8.BeginInit();
                        img8.UriSource = new Uri(Slot8, UriKind.Absolute);
                        img8.EndInit();
                        s8.Source = img8;

                        BitmapImage img9 = new BitmapImage();
                        img9.BeginInit();
                        img9.UriSource = new Uri(Slot9, UriKind.Absolute);
                        img9.EndInit();
                        s9.Source = img9;

                        BitmapImage img10 = new BitmapImage();
                        img10.BeginInit();
                        img10.UriSource = new Uri(Slot10, UriKind.Absolute);
                        img10.EndInit();
                        s10.Source = img10;

                        BitmapImage img11 = new BitmapImage();
                        img11.BeginInit();
                        img11.UriSource = new Uri(Slot11, UriKind.Absolute);
                        img11.EndInit();
                        s11.Source = img11;

                        BitmapImage img12 = new BitmapImage();
                        img12.BeginInit();
                        img12.UriSource = new Uri(Slot12, UriKind.Absolute);
                        img12.EndInit();
                        s12.Source = img12;

                        BitmapImage img13 = new BitmapImage();
                        img13.BeginInit();
                        img13.UriSource = new Uri(Slot13, UriKind.Absolute);
                        img13.EndInit();
                        s13.Source = img13;

                        BitmapImage img14 = new BitmapImage();
                        img14.BeginInit();
                        img14.UriSource = new Uri(Slot14, UriKind.Absolute);
                        img14.EndInit();
                        s14.Source = img14;

                        BitmapImage img15 = new BitmapImage();
                        img15.BeginInit();
                        img15.UriSource = new Uri(Slot15, UriKind.Absolute);
                        img15.EndInit();
                        s15.Source = img15;

                        BitmapImage img16 = new BitmapImage();
                        img16.BeginInit();
                        img16.UriSource = new Uri(Slot16, UriKind.Absolute);
                        img16.EndInit();
                        s16.Source = img16;

                        BitmapImage img17 = new BitmapImage();
                        img17.BeginInit();
                        img17.UriSource = new Uri(Slot17, UriKind.Absolute);
                        img17.EndInit();
                        s17.Source = img17;

                        BitmapImage img18 = new BitmapImage();
                        img18.BeginInit();
                        img18.UriSource = new Uri(Slot18, UriKind.Absolute);
                        img18.EndInit();
                        s18.Source = img18;
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show(
                        "It is not possible to connect to the news server. Please restart the program. If the error persists, again, please contact technical support project");
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }