/// <summary> /// Updates averages labels. /// </summary> /// <param name="view"></param> public void UpdateLabels(IViewInterface view) { view.BestValue = (Best == -1) ? "00:00:00:00" : TimeToString(Best); view.WorstValue = (Worst == -1) ? "00:00:00:00" : TimeToString(Worst); view.AverageValue = (Average == -1) ? "00:00:00:00" : TimeToString(Average); view.Bo5Value = (BO5 == -1) ? "00:00:00:00" : TimeToString(BO5); view.Bo12Value = (BO12 == -1) ? "00:00:00:00" : TimeToString(BO12); }
private readonly IViewInterface view; // view interface between controller and form #endregion public Controller(IViewInterface view) { this.view = view; // bind view state = State.WAIT; // defualt state currentCubeType = CubeType.THREE; // default cube view.DNF = " "; // not DNF tempSolve = GenerateSolve(); view.Scramble = tempSolve.Scramble; SoundControl = new Sound(DirName) { PlaySounds = true // defualt - play sounds }; view.CubeTypeLabelInter = ($"{CubeTypeToLabel(currentCubeType)}"); }
/// <summary> /// Initializes the view with elements. /// If there is more elements then argument howMany then it skips some statistics at the beginning. /// </summary> /// <param name="view"></param> /// <param name="howMany">How many elements should be presented at once</param> public void InitializeViewStatistics(IViewInterface view, int howMany) { Initialize(); view.ClearStatisticsBox(); for (int i = Math.Max(0, solves.Count - howMany); i < solves.Count; ++i) { TimeSpan x = TimeSpan.FromMilliseconds(solves[i].SolveTime); int length = 5; string paddedId = solves[i].Id.ToString(); int calculatePadLeft = (((length - paddedId.Length) / 2) + paddedId.Length); paddedId = paddedId.PadLeft(calculatePadLeft).PadRight(length); view.AddStatistics($"[{paddedId}] {x.ToString(@"hh\:mm\:ss\:ff")}"); } UpdateLabels(view); }
public static void Initialize(IViewInterface viewInterface) { Current = viewInterface; }
public Adapter(IViewInterface view) { concreteView = view; }