Exemplo n.º 1
0
 public FrmLadderView(LadderInstance ladder)
 {
     EventHandler handler = null;
     VGen0 method = null;
     this.components = null;
     this.mLadder = null;
     this.IsLadderParticipant = false;
     this.IsJoinPending = false;
     this.IsLeavePending = false;
     this.IsViewingChallengers = false;
     this.mSelectedParticipant = null;
     this.mCurrentPage = 0;
     this.mLastRating = -1;
     this.mCurrentDataSet = null;
     this.ToolstripSizeChanged = false;
     this.mCustomPaint = new List<ToolStripItem>();
     this.mLadder = ladder;
     this.InitializeComponent();
     base.MainForm.LadderGamePlayed += new EventHandler(this.MainForm_LadderGamePlayed);
     this.gpgLabelDates.Text = string.Format("{0} - {1}", this.Ladder.StartDate.ToShortDateString(), this.Ladder.EndDate.ToShortDateString());
     this.backLabelTitle.Text = this.Ladder.Description;
     this.gpgLabelRules.Text = this.Ladder.LadderDefinition.RulesDescription;
     this.gpgLabelDescription.Text = string.Format("{0}. {1}", this.Ladder.LadderDefinition.Name, this.Ladder.LadderDefinition.Description);
     this.Text = string.Format("<LOC>Ladder View - {0}", this.Ladder.LadderDefinition.Name);
     string data = "<LOC>Individual Ladder";
     if (this.Ladder.LadderDefinition.IsTeam)
     {
         data = "<LOC>Team Ladder";
     }
     else if (this.Ladder.LadderDefinition.IsClan)
     {
         data = "<LOC>Clan Ladder";
     }
     if (!this.AcceptingChallenges)
     {
         this.btnToggleMyChallenges.Image = SkinManager.GetImage(@"Dialog\LadderView\decline_challenges.png");
         this.btnToggleMyChallenges.ToolTipText = Loc.Get("<LOC>Declining Challenges");
     }
     else
     {
         this.btnToggleMyChallenges.Image = SkinManager.GetImage(@"Dialog\LadderView\accept_challenges.png");
         this.btnToggleMyChallenges.ToolTipText = Loc.Get("<LOC>Accepting Challenges");
     }
     this.gpgLabelType.Text = Loc.Get(data);
     if (handler == null)
     {
         handler = delegate (object o, EventArgs e) {
             this.backLabelTitle.Refresh();
             this.ResizePageLinks();
         };
     }
     base.SizeChanged += handler;
     this.IsLadderParticipant = new QuazalQuery("IsLadderParticipant", new object[] { User.Current.ID, this.Ladder.ID }).GetBool();
     this.IsJoinPending = new QuazalQuery("IsLadderJoinPending", new object[] { User.Current.ID, this.Ladder.ID }).GetBool();
     this.IsLeavePending = new QuazalQuery("IsLadderRemovePending", new object[] { User.Current.ID, this.Ladder.ID }).GetBool();
     if ((!base.Disposing && !base.IsDisposed) && base.IsHandleCreated)
     {
         if (method == null)
         {
             method = delegate {
                 if (this.IsJoinPending)
                 {
                     this.btnJoinLeave.ToolTipText = Loc.Get("<LOC>Join Pending");
                 }
                 else if (this.IsLeavePending)
                 {
                     this.btnJoinLeave.ToolTipText = Loc.Get("<LOC>Leave Pending");
                 }
                 else if (this.IsLadderParticipant)
                 {
                     this.btnJoinLeave.ToolTipText = Loc.Get("<LOC>Leave This Ladder");
                     this.btnJoinLeave.Image = this.btnJoinLeave.Image;
                 }
                 else
                 {
                     this.btnJoinLeave.ToolTipText = Loc.Get("<LOC>Join This Ladder");
                     this.btnJoinLeave.Image = this.btnJoinLeave.Image;
                 }
                 this.RefreshToolstrip();
             };
         }
         base.BeginInvoke(method);
     }
     this.RefreshDataSynchronous();
 }
Exemplo n.º 2
0
 internal void ResetLadderGame()
 {
     this.Ladder = null;
     this.IsLadderAutomatch = false;
 }
Exemplo n.º 3
0
 private void mSupcomGameManager_OnGameLaunched(object sender, EventArgs e)
 {
     if (this.mKind.IndexOf("TOURNY") == 0)
     {
         TournamentCommands.GameStarted();
     }
     if (this.Ladder != null)
     {
         string str = DataAccess.FormatDate(DateTime.UtcNow);
         if (!new QuazalQuery("CreateLadderGameSession", new object[] { this.Ladder.ID, User.Current.ID, DateTime.UtcNow, this.IsLadderAutomatch }).ExecuteNonQuery())
         {
             ErrorLog.WriteLine("Failed to create ladder session for automatch game.", new object[0]);
         }
     }
     this.Ladder = null;
 }
Exemplo n.º 4
0
 internal void RegisterLadderGame(LadderInstance ladder, bool isAutomatch)
 {
     this.Ladder = ladder;
     this.IsLadderAutomatch = isAutomatch;
 }
Exemplo n.º 5
0
 private void mSupcomGameManager_OnExit(object sender, EventArgs e)
 {
     this.Ladder = null;
     if (this.mSupcomGameManager.GameState == GameState.Lobby)
     {
         this.mSupcomGameManager.MessageGame("//AUTOABORT " + User.Current.Name.ToString());
     }
     this.NotifyStatus(Loc.Get("<LOC>Automatch Complete"));
     if (this.OnExit != null)
     {
         this.OnExit(this, EventArgs.Empty);
     }
     if (ConfigSettings.GetBool("AbortState", true))
     {
         Thread.Sleep(ConfigSettings.GetInt("AutoExitSleep", 100));
         try
         {
             this.mSupcomGameManager.SetAbort();
             if (ConfigSettings.GetBool("DisposeManager", false))
             {
                 this.mSupcomGameManager.Dispose();
             }
         }
         catch (Exception exception)
         {
             ErrorLog.WriteLine(exception);
         }
         if (ConfigSettings.GetBool("NullOutManagerManager", true))
         {
             this.mSupcomGameManager = null;
         }
     }
 }