void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.CardPackWnd = ((CardGameClient.CardPackWindow)(target)); #line 5 "..\..\..\CardPackWindow.xaml" this.CardPackWnd.ContentRendered += new System.EventHandler(this.Window_ContentRendered); #line default #line hidden return; case 2: this.CardNameLabel1 = ((System.Windows.Controls.Label)(target)); return; case 3: this.NewCardPlace1 = ((CardGameClient.CardPlace)(target)); return; case 4: this.CardNameLabel2 = ((System.Windows.Controls.Label)(target)); return; case 5: this.NewCardPlace2 = ((CardGameClient.CardPlace)(target)); return; case 6: this.CardNameLabel3 = ((System.Windows.Controls.Label)(target)); return; case 7: this.NewCardPlace3 = ((CardGameClient.CardPlace)(target)); return; } this._contentLoaded = true; }
public void BuyCards(int number) { string price = string.Empty; DoubleAnimation da = new DoubleAnimation(1, 0, TimeSpan.FromMilliseconds(250)); da.FillBehavior = FillBehavior.Stop; da.Completed += new EventHandler(delegate(object sender, EventArgs e) { ShopGrid.Visibility = Visibility.Hidden; }); ShopGrid.BeginAnimation(OpacityProperty, da); if (number == 1) price = "2000"; else if (number == 2) price = "4000"; else if (number == 3) price = "8000"; DialogWin dw = new DialogWin(this, "Внимание!\nПокупка карты будет стоить " + price + " очков\nЖелаете продолжить?", MessageBoxButton.YesNo); App.WindowList.Add(dw.Name, dw); if (dw.ShowDialog() == true) { new Action(delegate { List<Card> card = null; bool isError = false; App.ProxyMutex.WaitOne(); try { card = ServiceProxy.Proxy.BuyCard(App.UserName, number); App.charInfo = ServiceProxy.Proxy.EnterWorld(App.UserName); GetAllCard(); } catch (CommunicationException exc) { App.OnException(); isError = true; } App.ProxyMutex.ReleaseMutex(); if (isError) { App.OnConnectionError(); return; } if (card.Count == 0) { this.Dispatcher.Invoke(new Action(delegate { DialogWin dw2 = new DialogWin(this, "Недостаточно средств.\nДля покупки необходимо не менее " + price + " очков", MessageBoxButton.OK); App.WindowList.Add(dw2.Name, dw2); dw2.ShowDialog(); })); } else { this.Dispatcher.Invoke(new Action(delegate { Rating.Text = "Очки: " + App.charInfo.score; CardsScore.Text = "Очки: " + App.charInfo.score; CardPackWindow cpw = new CardPackWindow(card); App.WindowList.Add(cpw.Name, cpw); ShopGrid.Visibility = Visibility.Hidden; cpw.ShowDialog(); })); } }).BeginInvoke(new AsyncCallback(delegate(IAsyncResult ar) { }), null); } }