protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget openLabel = new TextWidget("Open".Localize()); openLabel.TextColor = RGBA_Bytes.White; openLabel.VAnchor = VAnchor.ParentCenter; openLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget openButton = new FatFlatClickWidget(openLabel); openButton.VAnchor = VAnchor.ParentBottomTop; openButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; openButton.Width = 100; openButton.Click += (sender, e) => { ChangeCollection(); }; buttonFlowContainer.AddChild(openButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 100; return(buttonContainer); }
private SlideWidget getItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; buttonContainer.HAnchor = HAnchor.ParentRight; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget removeLabel = new TextWidget("Remove".Localize()); removeLabel.TextColor = RGBA_Bytes.White; removeLabel.VAnchor = VAnchor.ParentCenter; removeLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget removeButton = new FatFlatClickWidget(removeLabel); removeButton.VAnchor = VAnchor.ParentBottomTop; removeButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; removeButton.Width = 100; removeButton.Click += onRemovePartClick; viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; prioritizeButtonLabel = new TextWidget("Prioritize".Localize()); prioritizeButtonLabel.TextColor = RGBA_Bytes.White; prioritizeButtonLabel.VAnchor = VAnchor.ParentCenter; prioritizeButtonLabel.HAnchor = HAnchor.ParentCenter; prioritizeButton = new FatFlatClickWidget(prioritizeButtonLabel); prioritizeButton.VAnchor = VAnchor.ParentBottomTop; prioritizeButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; prioritizeButton.Width = 100; prioritizeButton.Click += onPrioritizePartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(removeButton); buttonFlowContainer.AddChild(prioritizeButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 300; //buttonContainer.Width = 100; return(buttonContainer); }
SlideWidget getItemActionButtons() { int buttonWidth; if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen) { buttonWidth = 120; } else { buttonWidth = 80; } SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; ClickWidget removeButton = new ClickWidget(); removeButton.VAnchor = VAnchor.ParentBottomTop; removeButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; removeButton.Width = buttonWidth; TextWidget printLabel = new TextWidget("Remove".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; removeButton.AddChild(printLabel); removeButton.Click += RemoveConnectionLink_Click; ClickWidget editButton = new ClickWidget(); editButton.VAnchor = VAnchor.ParentBottomTop; editButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; editButton.Width = buttonWidth; TextWidget editLabel = new TextWidget("Edit".Localize()); editLabel.TextColor = RGBA_Bytes.White; editLabel.VAnchor = VAnchor.ParentCenter; editLabel.HAnchor = HAnchor.ParentCenter; editButton.AddChild(editLabel); editButton.Click += EditConnectionLink_Click; buttonFlowContainer.AddChild(editButton); buttonFlowContainer.AddChild(removeButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = buttonWidth * 2; return(buttonContainer); }
protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; printButton.Click += (sender, e) => { if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.AddItem(MakeCopyForQueue(), 0); QueueData.Instance.SelectedIndex = QueueData.Instance.Count - 1; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } else { QueueData.Instance.AddItem(MakeCopyForQueue()); } buttonContainer.SlideOut(); this.Invalidate(); };; TextWidget viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return(buttonContainer); }
SlideWidget getItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; ClickWidget printButton = new ClickWidget(); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; printButton.AddChild(printLabel); printButton.Click += (sender, e) => { QueueData.Instance.AddItem(this.printItemWrapper, 0); if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.SelectedIndex = 0; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } this.Invalidate(); };; ClickWidget editButton = new ClickWidget(); editButton.VAnchor = VAnchor.ParentBottomTop; editButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; editButton.Width = 100; TextWidget editLabel = new TextWidget("View".Localize()); editLabel.TextColor = RGBA_Bytes.White; editLabel.VAnchor = VAnchor.ParentCenter; editLabel.HAnchor = HAnchor.ParentCenter; editButton.AddChild(editLabel); editButton.Click += onViewPartClick; buttonFlowContainer.AddChild(editButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return(buttonContainer); }
SlideWidget getItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; buttonContainer.HAnchor = HAnchor.ParentRight; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; ClickWidget printButton = new ClickWidget(); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; TextWidget printLabel = new TextWidget("Remove".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; printButton.AddChild(printLabel); printButton.Click += (sender, e) => { UiThread.RunOnIdle(DeletePartFromQueue); };; ClickWidget viewButton = new ClickWidget(); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; TextWidget editLabel = new TextWidget("View".Localize()); editLabel.TextColor = RGBA_Bytes.White; editLabel.VAnchor = VAnchor.ParentCenter; editLabel.HAnchor = HAnchor.ParentCenter; viewButton.AddChild(editLabel); viewButton.Click += onViewPartClick; //buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); //buttonContainer.Width = 200; buttonContainer.Width = 100; return(buttonContainer); }
protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.Name = "Row Item " + partLabel.Text + " Print Button"; printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; printButton.Click += printButton_Click; // HACK: No clear immediate workaround beyond this printButton.Click += (s, e) => buttonContainer.SlideOut(); TextWidget viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.Name = "Row Item " + partLabel.Text + " View Button"; viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return(buttonContainer); }
protected SlideWidget GetItemActionButtons(string openButtonText) { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget openLabel = new TextWidget(openButtonText); openLabel.TextColor = RGBA_Bytes.White; openLabel.VAnchor = VAnchor.ParentCenter; openLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget openButton = new FatFlatClickWidget(openLabel); openButton.Cursor = Cursors.Hand; openButton.Name = "Open Collection"; openButton.VAnchor = VAnchor.ParentBottomTop; openButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; openButton.Width = 100; openButton.Click += (sender, e) => { ChangeCollection(); }; buttonFlowContainer.AddChild(openButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 100; return buttonContainer; }
protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; printButton.Click += printButton_Click; // HACK: No clear immediate workaround beyond this printButton.Click += (s, e) => buttonContainer.SlideOut(); TextWidget viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.Name = "Row Item " + partLabel.Text + " View Button"; viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return buttonContainer; }
private SlideWidget getItemActionButtons() { int buttonWidth; if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen) { buttonWidth = 120; } else { buttonWidth = 80;//80 } SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Remove".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget removeButton = new FatFlatClickWidget(printLabel); removeButton.VAnchor = VAnchor.ParentBottomTop; removeButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; removeButton.Width = buttonWidth; removeButton.Click += RemoveConnectionLink_Click; TextWidget editLabel = new TextWidget("Edit".Localize()); editLabel.TextColor = RGBA_Bytes.White; editLabel.VAnchor = VAnchor.ParentCenter; editLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget editButton = new FatFlatClickWidget(editLabel); editButton.VAnchor = VAnchor.ParentBottomTop; editButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; editButton.Width = buttonWidth; editButton.Click += EditConnectionLink_Click; buttonFlowContainer.AddChild(editButton); buttonFlowContainer.AddChild(removeButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = buttonWidth * 2; return buttonContainer; }
private void AddChildElements() { GuiWidget mainContainer = new GuiWidget(); mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; mainContainer.VAnchor = VAnchor.ParentBottomTop; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; { GuiWidget indicator = new GuiWidget(); indicator.VAnchor = Agg.UI.VAnchor.ParentBottomTop; indicator.Width = 15; if (printTask.PrintComplete) { indicator.BackgroundColor = new RGBA_Bytes(38, 147, 51, 180); } else { indicator.BackgroundColor = new RGBA_Bytes(252, 209, 22, 180); } FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight; middleColumn.Padding = new BorderDouble(6, 3); { FlowLayoutWidget labelContainer = new FlowLayoutWidget(); labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; string labelName = textInfo.ToTitleCase(printTask.PrintName); labelName = labelName.Replace('_', ' '); partLabel = new TextWidget(labelName, pointSize: 15 * pointSizeFactor); partLabel.TextColor = WidgetTextColor; labelContainer.AddChild(partLabel); middleColumn.AddChild(labelContainer); } RGBA_Bytes timeTextColor = new RGBA_Bytes(34, 34, 34); FlowLayoutWidget buttonContainer = new FlowLayoutWidget(); buttonContainer.Margin = new BorderDouble(0); buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; { TextWidget statusIndicator = new TextWidget("Status: Completed".Localize(), pointSize: 8 * pointSizeFactor); statusIndicator.Margin = new BorderDouble(right: 3); //buttonContainer.AddChild(statusIndicator); string printTimeLabel = "Time".Localize().ToUpper(); string printTimeLabelFull = string.Format("{0}: ", printTimeLabel); TextWidget timeLabel = new TextWidget(printTimeLabelFull, pointSize: 8 * pointSizeFactor); timeLabel.TextColor = timeTextColor; TextWidget timeIndicator; int minutes = printTask.PrintTimeMinutes; if (minutes < 0) { timeIndicator = new TextWidget("Unknown".Localize()); } else if (minutes > 60) { timeIndicator = new TextWidget("{0}hrs {1}min".FormatWith(printTask.PrintTimeMinutes / 60, printTask.PrintTimeMinutes % 60), pointSize: 12 * pointSizeFactor); } else { timeIndicator = new TextWidget(string.Format("{0}min", printTask.PrintTimeMinutes), pointSize: 12 * pointSizeFactor); } timeIndicator.Margin = new BorderDouble(right: 6); timeIndicator.TextColor = timeTextColor; buttonContainer.AddChild(timeLabel); buttonContainer.AddChild(timeIndicator); buttonContainer.AddChild(new HorizontalSpacer()); middleColumn.AddChild(buttonContainer); } GuiWidget primaryContainer = new GuiWidget(); primaryContainer.HAnchor = HAnchor.ParentLeftRight; primaryContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget primaryFlow = new FlowLayoutWidget(FlowDirection.LeftToRight); primaryFlow.HAnchor = HAnchor.ParentLeftRight; primaryFlow.VAnchor = VAnchor.ParentBottomTop; primaryFlow.AddChild(indicator); primaryFlow.AddChild(middleColumn); primaryContainer.AddChild(primaryFlow); rightButtonOverlay = new SlideWidget(); rightButtonOverlay.VAnchor = VAnchor.ParentBottomTop; rightButtonOverlay.HAnchor = Agg.UI.HAnchor.ParentRight; rightButtonOverlay.Width = rightOverlayWidth; rightButtonOverlay.Visible = false; FlowLayoutWidget rightMiddleColumnContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); rightMiddleColumnContainer.VAnchor = VAnchor.ParentBottomTop; { TextWidget viewLabel = new TextWidget("View".Localize()); viewLabel.TextColor = RGBA_Bytes.White; viewLabel.VAnchor = VAnchor.ParentCenter; viewLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = actionButtonSize; viewButton.Click += ViewButton_Click; rightMiddleColumnContainer.AddChild(viewButton); TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = actionButtonSize; printButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId), 0); QueueData.Instance.SelectedIndex = 0; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } else { QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId)); } rightButtonOverlay.SlideOut(); }); }; rightMiddleColumnContainer.AddChild(printButton); } rightButtonOverlay.AddChild(rightMiddleColumnContainer); if (showTimestamp) { FlowLayoutWidget timestampColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); timestampColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop; timestampColumn.BackgroundColor = RGBA_Bytes.LightGray; timestampColumn.Padding = new BorderDouble(6, 0); FlowLayoutWidget startTimeContainer = new FlowLayoutWidget(); startTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; startTimeContainer.Padding = new BorderDouble(0, 3); string startLabelFull = "{0}:".FormatWith("Start".Localize().ToUpper()); TextWidget startLabel = new TextWidget(startLabelFull, pointSize: 8 * pointSizeFactor); startLabel.TextColor = timeTextColor; string startTimeString = printTask.PrintStart.ToString("MMM d yyyy h:mm ") + printTask.PrintStart.ToString("tt").ToLower(); TextWidget startDate = new TextWidget(startTimeString, pointSize: 12 * pointSizeFactor); startDate.TextColor = timeTextColor; startTimeContainer.AddChild(startLabel); startTimeContainer.AddChild(new HorizontalSpacer()); startTimeContainer.AddChild(startDate); FlowLayoutWidget endTimeContainer = new FlowLayoutWidget(); endTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; endTimeContainer.Padding = new BorderDouble(0, 3); string endLabelFull = "{0}:".FormatWith("End".Localize().ToUpper()); TextWidget endLabel = new TextWidget(endLabelFull, pointSize: 8 * pointSizeFactor); endLabel.TextColor = timeTextColor; string endTimeString; if (printTask.PrintEnd != DateTime.MinValue) { endTimeString = printTask.PrintEnd.ToString("MMM d yyyy h:mm ") + printTask.PrintEnd.ToString("tt").ToLower(); } else { endTimeString = "Unknown".Localize(); } TextWidget endDate = new TextWidget(endTimeString, pointSize: 12 * pointSizeFactor); endDate.TextColor = timeTextColor; endTimeContainer.AddChild(endLabel); endTimeContainer.AddChild(new HorizontalSpacer()); endTimeContainer.AddChild(endDate); HorizontalLine horizontalLine = new HorizontalLine(); horizontalLine.BackgroundColor = RGBA_Bytes.Gray; timestampColumn.AddChild(endTimeContainer); timestampColumn.AddChild(horizontalLine); timestampColumn.AddChild(startTimeContainer); timestampColumn.Width = rightOverlayWidth; primaryFlow.AddChild(timestampColumn); } mainContainer.AddChild(primaryContainer); mainContainer.AddChild(rightButtonOverlay); this.AddChild(mainContainer); } }
protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; printButton.Click += (sender, e) => { if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.AddItem(MakeCopyForQueue(), 0); QueueData.Instance.SelectedIndex = QueueData.Instance.Count - 1; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } else { QueueData.Instance.AddItem(MakeCopyForQueue()); } buttonContainer.SlideOut(); this.Invalidate(); }; ; TextWidget viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return buttonContainer; }
private SlideWidget getItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; buttonContainer.HAnchor = HAnchor.ParentRight; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget removeLabel = new TextWidget("Remove".Localize()); removeLabel.TextColor = RGBA_Bytes.White; removeLabel.VAnchor = VAnchor.ParentCenter; removeLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget removeButton = new FatFlatClickWidget(removeLabel); removeButton.VAnchor = VAnchor.ParentBottomTop; removeButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; removeButton.Width = 100; removeButton.Click += onRemovePartClick; viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(removeButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; //buttonContainer.Width = 100; return buttonContainer; }
private void AddChildElements() { GuiWidget mainContainer = new GuiWidget(); mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; mainContainer.VAnchor = VAnchor.ParentBottomTop; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; { GuiWidget indicator = new GuiWidget(); indicator.VAnchor = Agg.UI.VAnchor.ParentBottomTop; indicator.Width = 15; if (printTask.PrintComplete) { indicator.BackgroundColor = new RGBA_Bytes(38, 147, 51, 180); } else { indicator.BackgroundColor = new RGBA_Bytes(252, 209, 22, 180); } FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight; middleColumn.Padding = new BorderDouble(6, 3); { FlowLayoutWidget labelContainer = new FlowLayoutWidget(); labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; string labelName = textInfo.ToTitleCase(printTask.PrintName); labelName = labelName.Replace('_', ' '); partLabel = new TextWidget(labelName, pointSize: 15 * pointSizeFactor); partLabel.TextColor = WidgetTextColor; labelContainer.AddChild(partLabel); middleColumn.AddChild(labelContainer); } RGBA_Bytes timeTextColor = new RGBA_Bytes(34, 34, 34); FlowLayoutWidget buttonContainer = new FlowLayoutWidget(); buttonContainer.Margin = new BorderDouble(0); buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; { TextWidget statusIndicator = new TextWidget("Status: Completed".Localize(), pointSize: 8 * pointSizeFactor); statusIndicator.Margin = new BorderDouble(right: 3); //buttonContainer.AddChild(statusIndicator); string printTimeLabel = "Time".Localize().ToUpper(); string printTimeLabelFull = string.Format("{0}: ", printTimeLabel); TextWidget timeLabel = new TextWidget(printTimeLabelFull, pointSize: 8 * pointSizeFactor); timeLabel.TextColor = timeTextColor; TextWidget timeIndicator; int minutes = printTask.PrintTimeMinutes; if (minutes < 0) { timeIndicator = new TextWidget("Unknown".Localize()); } else if (minutes > 60) { timeIndicator = new TextWidget("{0}hrs {1}min".FormatWith(printTask.PrintTimeMinutes / 60, printTask.PrintTimeMinutes % 60), pointSize: 12 * pointSizeFactor); } else { timeIndicator = new TextWidget(string.Format("{0}min", printTask.PrintTimeMinutes), pointSize: 12 * pointSizeFactor); } if (printTask.PercentDone > 0) { timeIndicator.AutoExpandBoundsToText = true; timeIndicator.Text += " ({0:0.0}%)".FormatWith(printTask.PercentDone); } timeIndicator.Margin = new BorderDouble(right: 6); timeIndicator.TextColor = timeTextColor; buttonContainer.AddChild(timeLabel); buttonContainer.AddChild(timeIndicator); buttonContainer.AddChild(new HorizontalSpacer()); middleColumn.AddChild(buttonContainer); } GuiWidget primaryContainer = new GuiWidget(); primaryContainer.HAnchor = HAnchor.ParentLeftRight; primaryContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget primaryFlow = new FlowLayoutWidget(FlowDirection.LeftToRight); primaryFlow.HAnchor = HAnchor.ParentLeftRight; primaryFlow.VAnchor = VAnchor.ParentBottomTop; primaryFlow.AddChild(indicator); primaryFlow.AddChild(middleColumn); primaryContainer.AddChild(primaryFlow); rightButtonOverlay = new SlideWidget(); rightButtonOverlay.VAnchor = VAnchor.ParentBottomTop; rightButtonOverlay.HAnchor = Agg.UI.HAnchor.ParentRight; rightButtonOverlay.Width = rightOverlayWidth; rightButtonOverlay.Visible = false; FlowLayoutWidget rightMiddleColumnContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); rightMiddleColumnContainer.VAnchor = VAnchor.ParentBottomTop; { TextWidget viewLabel = new TextWidget("View".Localize()); viewLabel.TextColor = RGBA_Bytes.White; viewLabel.VAnchor = VAnchor.ParentCenter; viewLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = actionButtonSize; viewButton.Click += ViewButton_Click; rightMiddleColumnContainer.AddChild(viewButton); TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = actionButtonSize; printButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId), 0); QueueData.Instance.SelectedIndex = 0; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } else { QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId)); } rightButtonOverlay.SlideOut(); }); }; rightMiddleColumnContainer.AddChild(printButton); } rightButtonOverlay.AddChild(rightMiddleColumnContainer); if (showTimestamp) { FlowLayoutWidget timestampColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); timestampColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop; timestampColumn.BackgroundColor = RGBA_Bytes.LightGray; timestampColumn.Padding = new BorderDouble(6, 0); FlowLayoutWidget startTimeContainer = new FlowLayoutWidget(); startTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; startTimeContainer.Padding = new BorderDouble(0, 3); string startLabelFull = "{0}:".FormatWith("Start".Localize().ToUpper()); TextWidget startLabel = new TextWidget(startLabelFull, pointSize: 8 * pointSizeFactor); startLabel.TextColor = timeTextColor; string startTimeString = printTask.PrintStart.ToString("MMM d yyyy h:mm ") + printTask.PrintStart.ToString("tt").ToLower(); TextWidget startDate = new TextWidget(startTimeString, pointSize: 12 * pointSizeFactor); startDate.TextColor = timeTextColor; startTimeContainer.AddChild(startLabel); startTimeContainer.AddChild(new HorizontalSpacer()); startTimeContainer.AddChild(startDate); FlowLayoutWidget endTimeContainer = new FlowLayoutWidget(); endTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; endTimeContainer.Padding = new BorderDouble(0, 3); string endLabelFull = "{0}:".FormatWith("End".Localize().ToUpper()); TextWidget endLabel = new TextWidget(endLabelFull, pointSize: 8 * pointSizeFactor); endLabel.TextColor = timeTextColor; string endTimeString; if (printTask.PrintEnd != DateTime.MinValue) { endTimeString = printTask.PrintEnd.ToString("MMM d yyyy h:mm ") + printTask.PrintEnd.ToString("tt").ToLower(); } else { endTimeString = "Unknown".Localize(); } TextWidget endDate = new TextWidget(endTimeString, pointSize: 12 * pointSizeFactor); endDate.TextColor = timeTextColor; endTimeContainer.AddChild(endLabel); endTimeContainer.AddChild(new HorizontalSpacer()); endTimeContainer.AddChild(endDate); HorizontalLine horizontalLine = new HorizontalLine(); horizontalLine.BackgroundColor = RGBA_Bytes.Gray; timestampColumn.AddChild(endTimeContainer); timestampColumn.AddChild(horizontalLine); timestampColumn.AddChild(startTimeContainer); timestampColumn.HAnchor = HAnchor.ParentLeftRight; timestampColumn.Padding = new BorderDouble(5, 0, 15, 0); primaryFlow.AddChild(timestampColumn); } mainContainer.AddChild(primaryContainer); mainContainer.AddChild(rightButtonOverlay); this.AddChild(mainContainer); } }