Пример #1
0
 private bool UpdateRemainedServerTime(ServerInfo newInfo, ServerI row, DXCCTrayIntegrator integrator)
 {
     //if (IsServerForUser(row) && newInfo.RemainedTime > 0) {
     //    row.Details = String.Format("Remained {0} min", newInfo.RemainedTime);
     //    if (newInfo.Creator.Equals(DXCCTrayConfiguration.WorkUserName, StringComparison.InvariantCultureIgnoreCase) && newInfo.RemainedTime < minimumRemainedTime && row.Remained > 0 && row.Remained == minimumRemainedTime) {
     //        row.Remained = newInfo.RemainedTime;
     //        if (XtraMessageBox.Show(String.Format("Do you want to prolong server \"{0}\" for 1 hour?", row.Server), "DXCCTray", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) {
     //            integrator.UpdateServerTime(row.Server, 60);
     //        }
     //    }
     //    return true;
     //}
     return(false);
 }
Пример #2
0
 void integrator_OnServersChanged(DXCCTrayIntegrator integrator)
 {
     try {
         if (skipUpdateControllerServers.SkipUpdate())
         {
             return;
         }
         object update = new object();
         lock (integrator.ServerList) {
             foreach (ServerInfo newInfo in integrator.ServerList)
             {
                 ServerI row;
                 if (!serverDict.TryGetValue(new ProjectKey(integrator.Name, newInfo.Name), out row))
                 {
                     row        = new ServerI();
                     row.Farm   = integrator.Name;
                     row.Server = newInfo.Name;
                     serverTable.Add(row);
                     serverDict.Add(new ProjectKey(row.Farm, row.Server), row);
                 }
                 row.Farm    = integrator.Name;
                 row.Types   = new List <string>(newInfo.Types);
                 row.Running = newInfo.IsRunning;
                 row.Host    = newInfo.Host;
                 row.Vmid    = newInfo.VMID;
                 row.Status  = newInfo.Status;
                 //row.Project = (string.IsNullOrEmpty(newInfo.ProjectName)) ? newInfo.Creator == null ? "Free" : GetPersonalServerTitle(newInfo.Creator) : newInfo.ProjectName;
                 UpdateRemainedServerTime(newInfo, row, integrator);
                 row.Remained = newInfo.RemainedTime;
                 row.Update   = update;
                 //if (IsServerForUser(row)) {
                 //    CustomServerProcess(newInfo, integrator, newServer);
                 //}
                 row.Remained = newInfo.RemainedTime;
             }
         }
         for (int i = 0; i < serverTable.Count; i++)
         {
             ServerI row = serverTable[i];
             if (row.Farm == integrator.Name && row.Update != update)
             {
                 serverDict.Remove(new ProjectKey(row.Farm, row.Server));
                 serverTable.RemoveAt(i);
                 i--;
             }
         }
         //if (!focusedGroupped && serverTable.Contains(focusedRow)) {
         //    int focusedRowHandle = gridViewServers.GetRowHandle(serverTable.IndexOf(focusedRow));
         //    gridViewServers.FocusedRowHandle = focusedRowHandle;
         //}
         //gridViewServers.ClearSelection();
         //foreach (ServerI selected in selectedRows) {
         //    if (serverTable.Contains(selected)) {
         //        gridViewServers.SelectRow(gridViewServers.GetRowHandle(serverTable.IndexOf(selected)));
         //    }
         //}
     }
     catch (Exception ex) {
         Log.Error("error", ex);
         throw;
     }
 }