public Team(TeamData td, SetDataTriggerHandler dataHandler, bool canFocus) { this.Build(); teamData = td; MiscHelpers.SetIsShown(vboxInfos, false); MiscHelpers.SetIsShown(lblFullTeamName, false); if (teamData == null) { Label lbl = new Label(); lbl.Markup = "<i>No Team</i>"; alBtn.Add(lbl); alBtn.ShowAll(); return; } td.Sort(); btnExpand = new MyButton(this, teamData.TeamName, "go-down", "go-next"); btnExpand.CanFocus = canFocus; btnExpand.Clicked += OnBtnExpandClicked; alBtn.Add(btnExpand); alBtn.ShowAll(); // conflict...not shown by default btnConflict = new MyConflictButton(); alConflictBtn.Add(btnConflict); // when members are draggable, team is also draggable. if (dataHandler != null) { SetDataTrigger += dataHandler; } SetupTeamMembers(dataHandler); }
// method only used by DebaterPool public void UpdateTeamMembers() { int shownMembers = teamData.ShownMembers; if (shownMembers == 0) { MiscHelpers.SetIsShown(this, false); return; } else if (shownMembers == vboxTeamMembers.Children.Length) { // complete Team btnExpand.ResetLabelColor(); Drag.SourceSet(btnExpand, Gdk.ModifierType.Button1Mask, DragDropHelpers.TgtTeam, Gdk.DragAction.Move); } else { // incomplete Team btnExpand.LabelColor = new Gdk.Color(160, 0, 0); Drag.SourceUnset(btnExpand); } MiscHelpers.SetIsShown(this, true); }
public void SetIsInPool(bool flag, string roundName) { roundDebater.IsShown = flag; MiscHelpers.SetIsShown(this, flag); if (flag) { SetRoom(roundName, RoomData.Dummy()); } }
public DebaterWidget(RoundDebater rd, bool canFocus, bool showDebaterName) { this.Build(); roundDebater = rd; debater = null; debaterValid = false; infoWidgets = new Dictionary <string, Widget>(); if (roundDebater == null) { Label lbl = new Label(); lbl.Markup = "<i>No Debater</i>"; lbl.Xalign = 0f; alBtn.Add(lbl); alBtn.ShowAll(); MiscHelpers.SetIsShown(hboxInfo, false); return; } // btnExpand Setup btnExpand = new MyButton(this, rd.Name.ToString(), "weather-clear", "weather-clear-night"); btnExpand.CanFocus = canFocus; btnExpand.Clicked += OnBtnExpandClicked; alBtn.Add(btnExpand); alBtn.ShowAll(); // infoLabels Setup SetupInfo(showDebaterName); // conflict notifications btnConflict = new MyConflictButton(); alConflictBtn.Add(btnConflict); // (default not shown, // activated by ShowJudgeAvail from DebaterPool) btnJudgeState = new MyJudgeStateButton(roundDebater); btnExpand.SetStrikeThrough(!rd.JudgeAvail); btnJudgeState.Changed += delegate { btnExpand.SetStrikeThrough(!rd.JudgeAvail); if (JudgeStateChanged != null) { JudgeStateChanged(this, EventArgs.Empty); } }; alJudgeState.Add(btnJudgeState); alJudgeState.NoShowAll = true; // SetIsShown in Realized so that everything is counted correctly by triggered events Realized += delegate(object sender, EventArgs e) { MiscHelpers.SetIsShown(this, roundDebater.IsShown); MiscHelpers.SetIsShown(hboxInfo, false); }; }
public void SetIsInPool(bool flag, string roundName) { foreach (RoundDebater d in teamData) { d.IsShown = flag; } MiscHelpers.SetIsShown(this, flag); if (flag) { SetRoom(roundName, RoomData.Dummy()); } }
void UpdateBestOnes() { // hide all MiscHelpers.SetIsShown(lblBestTeam, false); MiscHelpers.SetIsShown(lblBestSpeaker, false); for (int i = 0; i < 11; i++) { MiscHelpers.SetIsShown(bestOnes[i], false); } // determine best team var pGov = labels[13].GetValue(); var pOpp = labels[14].GetValue(); // is one of the teams incomplete? if (pGov < 0 || pOpp < 0) { return; } if (pGov > pOpp) { bestOnes[9].Active = true; MiscHelpers.SetIsShown(bestOnes[9], true); } else if (pGov < pOpp) { bestOnes[10].Active = true; MiscHelpers.SetIsShown(bestOnes[10], true); } else { // conflict MiscHelpers.SetIsShown(lblBestTeam, true); // use saved information, if available if (roomData.BestTeam == 1) { bestOnes[10].Active = true; } else { bestOnes[9].Active = true; } // show both MiscHelpers.SetIsShown(bestOnes[9], true); MiscHelpers.SetIsShown(bestOnes[10], true); } // UpdateBestSpeaker is called by updating setting bestOnes.Active }
public bool MatchesSearchString(string key) { bool flag = false; foreach (DebaterWidget w in vboxTeamMembers) { if (w.MatchesSearchString(key)) { flag = true; // iterate further so all teammembers get red... } } bool toggled = flag && key != ""; MiscHelpers.SetIsShown(vboxInfos, toggled); btnExpand.Toggled = toggled; return(flag); }
public void SetRoomData(string rN, RoomData rd) { // before updating roomData, do some stuff if (roomData != null) { RemoveTableColumns(judgesOffset, (uint)roomData.Judges.Count); // this ensures that the rows are in standard order // it's necessary for UpdateRoomData() RepositionTeamRowsBack(posGov); RepositionTeamRowsBack(posOpp); } roomData = rd; if (roomData != null) { UpdateRoomData(); } MiscHelpers.SetIsShown(lblNoRoomData, roomData == null); MiscHelpers.SetIsShown(table, roomData != null); }
void UpdateGui() { // set both labels... labelRoomName.Markup = "<b>" + roomData.RoomName + "</b>"; labelRoomNo.Markup = "<big><b>" + (roomData.Index + 1) + "</b></big>"; labelRoomNoRight.Markup = "<big><b>" + (roomData.Index + 1) + "</b></big>"; // small or big? if (small) { MiscHelpers.SetIsShown(frameBig, false); for (int i = 0; i < widgetsContainer.Count; i++) { if (cBig[i].Children.Length > 0) { cBig[i].Remove(widgetsContainer[i]); cSmall[i].Add(widgetsContainer[i]); } } MiscHelpers.SetIsShown(alignSmall, true); } else { MiscHelpers.SetIsShown(alignSmall, false); for (int i = 0; i < widgetsContainer.Count; i++) { if (cSmall[i].Children.Length > 0) { cSmall[i].Remove(widgetsContainer[i]); cBig[i].Add(widgetsContainer[i]); } } MiscHelpers.SetIsShown(frameBig, true); } foreach (string sec in sections) { UpdateGuiSection(sec); } // update always conflicts, cause we don't know what can happen ;) UpdateConflicts(); }
public static Team Small(TeamData td) { Team t = new Team(td, null); // generate abbreviated team name string abbrTeamName = ""; int words = 0; foreach (string s in OPDtabData.MiscHelpers.StringToWords(td.TeamName)) { //Console.WriteLine(td.TeamName+" "+s); string tmp = s.Length > 2 ? s.Substring(0, 2) + ". " : s; abbrTeamName = abbrTeamName + tmp; words++; if (words > 2) { break; } } t.btnExpand.LabelText = abbrTeamName; t.lblFullTeamName.Markup = "<small>" + GLib.Markup.EscapeText(td.TeamName) + "</small>"; MiscHelpers.SetIsShown(t.lblFullTeamName, true); return(t); }
protected virtual void OnBtnExpandClicked(object sender, System.EventArgs e) { UpdateInfo(); MiscHelpers.SetIsShown(hboxInfo, btnExpand.Toggled); }
public void ShowJudgeState() { alJudgeState.RightPadding = 3; MiscHelpers.SetIsShown(alJudgeState, true); }
void UpdateBestSpeaker() { // hide best speaker stuff MiscHelpers.SetIsShown(lblBestSpeaker, false); for (int i = 0; i < 9; i++) { MiscHelpers.SetIsShown(bestOnes[i], false); } // continue only if teams are complete if (labels[13].GetValue() < 0 || labels [14].GetValue() < 0) { return; } // determine max points of non-teambreaking speaker var max = -1.0; List <int> exclude = new List <int>(roomData.BestTeam == 1 ? posOpp : posGov); for (int i = 0; i < 9; i++) { var n = labels[i].GetValue(); // abort if one is incomplete if (n < 0) { return; } // exclude winning team if (exclude.Contains(i)) { continue; } // set max if (n > max) { max = n; } } // show all buttons List <int> bestSpeakers = new List <int>(); for (int i = 0; i < 9; i++) { var n = labels[i].GetValue(); if (exclude.Contains(i)) { continue; } if (n == max) { bestSpeakers.Add(i); MiscHelpers.SetIsShown(bestOnes[i], true); //bestOnes[i].Active = true; } } // do we have a valid saved result? if (bestSpeakers.Contains(roomData.BestSpeaker)) { bestOnes[roomData.BestSpeaker].Active = true; } else { // default bestOnes[bestSpeakers[0]].Active = true; } // more than one speaker could break? if (bestSpeakers.Count > 1) { MiscHelpers.SetIsShown(lblBestSpeaker, true); } }
void UpdateGui() { MiscHelpers.SetIsShown(image, radiobutton.Active); MiscHelpers.SetIsShown(radiobutton, !radiobutton.Active); }
protected virtual void OnBtnHideClicked(object sender, System.EventArgs e) { MiscHelpers.SetIsShown(this.Parent, false); }