private void Tag_Toggled(object sender, EventArgs e) { if (handlingTagToggle) { return; } StepTag tag = (StepTag)sender; try { handlingTagToggle = true; if (tag.Active) { foreach (StepTag stepTag in tags) { if (!ReferenceEquals(stepTag, tag)) { stepTag.Active = false; } } SetActiveStep(tag.Step); } else { tag.Active = true; } } finally { handlingTagToggle = false; } }
private void AppendStep(StepBase step) { int curIndex = steps.IndexOf(currentStep); for (int i = steps.Count - 1; i > curIndex; i--) { StepTag t = tags [curIndex]; hboSteps.Remove(t); tags.RemoveAt(i); StepBase s = steps [i]; s.StatusChanged -= step_StatusChanged; steps.RemoveAt(i); } steps.Add(step); step.Assistant = this; step.StatusChanged += step_StatusChanged; StepTag tag = new StepTag(step); tag.Show(); tag.Toggled += Tag_Toggled; hboSteps.PackStart(tag, false, true, 0); tags.Add(tag); SetActiveStep(step); }
private void UpdateStepStatuses() { for (int i = tblUnfinished.Children.Length - 1; i >= 0; i--) { Widget child = tblUnfinished.Children [i]; tblUnfinished.Remove(child); child.Destroy(); } uint r = 0; foreach (StepBase step in Assistant.Steps) { if (step is StepDBSetup || step is StepDBFinish) { continue; } tblUnfinished.Attach(StepTag.GetStatusImage(step.Status), 1, 2, r, r + 1, AttachOptions.Fill, AttachOptions.Fill, 4, 4); tblUnfinished.Attach(new Label(step.Title) { Xalign = 0f }, 2, 3, r, r + 1, AttachOptions.Fill, AttachOptions.Fill, 4, 4); r++; } tblUnfinished.Attach(new Label(), 0, 1, 0, r, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0); tblUnfinished.Attach(new Label(), 3, 4, 0, r, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0); tblUnfinished.ShowAll(); }
private void SetActiveStep(StepBase step) { if (algContent.Child != null) { algContent.Remove(algContent.Child); } algContent.Add(step.Body); currentStep = step; int newIndex = steps.IndexOf(step); int totalVisible = 0; for (int i = tags.Count - 1; i >= 0; i--) { StepTag tag = tags [i]; bool visible = i <= newIndex + MAX_VISIBLE_NEXT; if (visible) { totalVisible++; } tag.Visible = visible && totalVisible <= MAX_VISIBLE_TOTAL; if (ReferenceEquals(tag.Step, step)) { tag.Active = true; } } for (int i = newIndex + MAX_VISIBLE_NEXT + 1; i < tags.Count && totalVisible < MAX_VISIBLE_TOTAL; i++) { tags [i].Visible = true; totalVisible++; } btnBack.Visible = newIndex != 0; lblSteps.SetText(string.Format("{0}/{1}", newIndex + 1, allSteps.Count)); dlgAssistant.Resize(OPTIMAL_DIALOG_WIDTH, OPTIMAL_DIALOG_HEIGHT); RefreshForwardButtonsSensitivity(); }