public PrintProgressBar(bool widgetIsExtended = true) { MinimumSize = new Vector2(0, 24); HAnchor = HAnchor.ParentLeftRight; BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; Margin = new BorderDouble(0); FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.LeftToRight); container.AnchorAll(); container.Padding = new BorderDouble(6, 0); printTimeElapsed = new TextWidget("", pointSize: 11); printTimeElapsed.Printer.DrawFromHintedCache = true; printTimeElapsed.AutoExpandBoundsToText = true; printTimeElapsed.VAnchor = VAnchor.ParentCenter; printTimeRemaining = new TextWidget("", pointSize: 11); printTimeRemaining.Printer.DrawFromHintedCache = true; printTimeRemaining.AutoExpandBoundsToText = true; printTimeRemaining.VAnchor = VAnchor.ParentCenter; container.AddChild(printTimeElapsed); container.AddChild(new HorizontalSpacer()); container.AddChild(printTimeRemaining); AddChild(container); if (UserSettings.Instance.IsTouchScreen) { upImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_up_32x24.png"); downImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_down_32x24.png"); indicatorWidget = new ImageWidget(upImageBuffer); indicatorWidget.HAnchor = HAnchor.ParentCenter; indicatorWidget.VAnchor = VAnchor.ParentCenter; WidgetIsExtended = widgetIsExtended; GuiWidget indicatorOverlay = new GuiWidget(); indicatorOverlay.AnchorAll(); indicatorOverlay.AddChild(indicatorWidget); AddChild(indicatorOverlay); } var clickOverlay = new GuiWidget(); clickOverlay.AnchorAll(); clickOverlay.Click += (s, e) => { // In touchscreen mode, expand or collapse the print status row when clicked ApplicationView mainView = ApplicationController.Instance.MainView; if (mainView is TouchscreenView) { ((TouchscreenView)mainView).ToggleTopContainer(); } }; AddChild(clickOverlay); PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents); PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents); SetThemedColors(); UpdatePrintStatus(); UiThread.RunOnIdle(OnIdle); }