private void Window_Loaded(object sender, RoutedEventArgs e) { ProgressControl.Show("Carregando Dispositivo"); LoadSongListFromResource(); ApplyMusicsToDataGrid(); ProgressControl.Hide("Dispositivo Pronto"); }
internal PartProcessingInfo(string startingTextMessage) : base(FlowDirection.TopToBottom) { progressControl = new ProgressControl("", Color.Black, Color.Black); progressControl.HAnchor = HAnchor.Center; AddChild(progressControl); progressControl.Visible = false; //progressControl.ProgressChanged += (sender, e) => //{ // progressControl.Visible = true; //}; centeredInfoText = new TextWidget(startingTextMessage); centeredInfoText.HAnchor = HAnchor.Center; centeredInfoText.AutoExpandBoundsToText = true; AddChild(centeredInfoText); centeredInfoDescription = new TextWidget(""); centeredInfoDescription.HAnchor = HAnchor.Center; centeredInfoDescription.AutoExpandBoundsToText = true; AddChild(centeredInfoDescription); VAnchor |= VAnchor.Center; HAnchor |= HAnchor.Center; }
private void Start() { winScreen = transform.Find("WinScreen").gameObject; winText = transform.Find("WinScreen/WinMessage").GetComponent <Text>(); restartButton = transform.Find("WinScreen/RestartButton").GetComponent <Button>(); quitButton = transform.Find("WinScreen/QuitButton").GetComponent <Button>(); messageBox = transform.Find("MessageBox").GetComponent <UIMessageBox>(); messageBox.Init(); countDown = transform.Find("CountDown").GetComponent <CountDownControl>(); countDown.Init(this); winScreen.SetActive(false); helpTextBox = transform.Find("HelpText").gameObject; helpTextLabel = transform.Find("HelpText/Label").GetComponent <Text>(); ClearHelpText(); restartButton.onClick.AddListener(RestartButtonPressed); quitButton.onClick.AddListener(QuitButtonPressed); progress = transform.Find("Progress").GetComponent <ProgressControl>(); tipsDisplay = transform.Find("Tips").GetComponent <UITipsDisplay>(); lobby = transform.Find("LobbyUI").GetComponent <UILobby>(); audioSource = Camera.main.gameObject.AddComponent <AudioSource>(); }
private void InitializeComponent() { Bounds = new UniRectangle( 10, 10, new UniScalar(1.0f, -20), 35 ); var label = new LabelControl(); label.Text = _ability.Name; label.Bounds = new UniRectangle(10, 5, 180, 30); Children.Add(label); label = new LabelControl(); label.Text = ((int)(_exp / 100)).ToString(); label.Bounds = new UniRectangle(190, 5, 30, 30); Children.Add(label); var progress = new ProgressControl(); progress.Progress = (_exp % 100) / 100.0f; progress.Bounds = new UniRectangle(225, 5, new UniScalar(1.0f, -270), new UniScalar(1.0f, -5.0f)); Children.Add(progress); label = new LabelControl(); label.Text = ((int)(_exp % 100)).ToString(); label.Bounds = new UniRectangle(new UniScalar(1.0f, -35), 5, 30, 30); Children.Add(label); }
/// ------------------------------------------------------------------------------------ public ProgressDlg(IProgressViewModel model, string caption, bool showCancel) { Logger.WriteEvent("ProgressDlg constructor. caption = {0}", caption); _model = model; InitializeComponent(); _model.OnFinished += HandleFinished; var copyControl = new ProgressControl(_model); copyControl.Dock = DockStyle.Fill; _tableLayout.Controls.Add(copyControl, 0, 0); _tableLayout.SetColumnSpan(copyControl, 3); Text = caption; if (showCancel) { _buttonCancel.Visible = true; _buttonOK.Visible = false; _buttonCancel.Click += delegate { Logger.WriteEvent("Cancelled {0}", Text); _model.Cancel(); }; } }
private void HandleAtualizarDispositivoClick(object sender, RoutedEventArgs e) { ProgressControl.Show("Atualizando Dispositivo"); LoadSongListFromResource(); ApplyMusicsToDataGrid(); UpdateSelectedMusics(); ProgressControl.Hide("Dispositivo Atualizado"); }
protected override void start() { base.start(); StarPrefab = GameObject.FindGameObjectWithTag("Star"); progressControl = basicGameControl.SubController <ProgressControl>("ProgressControl"); StarPrefab.SetActive(false); basicGameControl.addEvent("Reset", reset); }
private void Set_Click(object sender, RoutedEventArgs e) { isStop = true; startedTime = DateTime.Now; ProgressControl.SetBarLength(0.0); ProgressAmount = 0.0; setCount++; txtSet.Text += "Set: " + setCount + " Seconds: " + timePassed.Seconds + " Minutes: " + timePassed.Minutes + "\n"; }
//This makes the circle timer reset when it reaches a full circle as well as as the timesTicked //which is essentially how much time has passed in an instance private void dispatcherTimer_Tick(object sender, object e) { timesTicked++; ProgressControl.SetBarLength(ProgressAmount); ProgressAmount += (1.0 / 60.0) * (7.95 / 60.0); if (ProgressAmount > 1.0) { ProgressAmount = 0.0; } }
public void CreateProgressControl(ProgressModel progressModel) { var progressControl = new ProgressControl(progressModel); StackPanel.Children.Add(progressControl); ProgressLedger.Add(progressModel, progressControl); ResizeWindow(); RepositonWindow(); Show(); }
public void HandleTimerTick(Object state) { lock (LockObject) { ProgressControl.SetBarLength(ProgressAmount); ProgressAmount += 0.006; if (ProgressAmount > 1.5) { ProgressAmount = 0.0; } } }
private void AddLoadingProgressBar() { processingProgressControl = new ProgressControl("Downloading...".Localize(), RGBA_Bytes.Black, ActiveTheme.Instance.SecondaryAccentColor, (int)(100 * TextWidget.GlobalPointSizeScaleRatio), 5) { PointSize = 8, }; //processingProgressControl.BackgroundColor = RGBA_Bytes.White; processingProgressControl.VAnchor = VAnchor.ParentBottom; processingProgressControl.HAnchor = HAnchor.ParentLeft; processingProgressControl.Margin = new BorderDouble(thumbnailWidth + 3, 3, 3, 3); processingProgressControl.Visible = false; this.AddChild(processingProgressControl); }
private void AddLoadingProgressBar() { processingProgressControl = new ProgressControl("Downloading...".Localize(), RGBA_Bytes.Black, ActiveTheme.Instance.SecondaryAccentColor, (int)(100 * GuiWidget.DeviceScale), 5, 0) { PointSize = 8, }; //processingProgressControl.BackgroundColor = RGBA_Bytes.White; processingProgressControl.VAnchor = VAnchor.ParentBottom; processingProgressControl.HAnchor = HAnchor.ParentLeft; processingProgressControl.Margin = new BorderDouble(0); processingProgressControl.Visible = false; middleColumn.AddChild(processingProgressControl); }
public void Desencriptador(string llavePublica, string llavePrivada, ref ProgressControl obj2) { long n, m; string nombreArchivo; long nLine; nLine = 0; long[] e, d; string texto, linea, scrip; string[] arrayPalabras, arrayNumeros, arrayCifrado; texto = ""; linea = ""; e = toDec(llavePublica); d = toDec(llavePrivada); n = d[0]; m = d[1]; if (validar_desencriptado(e, d) == true) { fileName = leer_archivo(); contarLineas(rootFile); obj2.Show(); obj1.GroupBox1.Visible = true; while (!FileSystem.EOF(1)) { Progreso(obj2, "DESencriptando Archivo", nLine, numbersLine); scrip = Strings.Trim(FileSystem.LineInput(1)); if (scrip != "") { arrayCifrado = Get_words(scrip, "@"); arrayNumeros = Code2Number(n, m, arrayCifrado); arrayCifrado = null; arrayPalabras = Number2Translate(arrayNumeros); arrayNumeros = null; linea = NewLine(arrayPalabras, " "); arrayPalabras = null; texto += linea + Constants.vbNewLine; } nLine = nLine + 1; } nombreArchivo = Cerrar_Archivo(texto); } }
public void Init() { InitializeComponent(); this.Icon = main.gIcon; //this.Owner //gTrace.Writed += new WritedEvent(WriteLog); gTrace.SetViewer(WriteLog); //string logFile = gTrace.GetLogFile(); //if (logFile != null && File.Exists(logFile)) // WriteLog(zfile.ReadAllText(logFile)); gsTitle = this.Text; this.TextChanged += new EventHandler(MainForm_TextChanged); gTask1ProgressControl = new ProgressControl(task1_lb_progress_label1, task1_pb_progress_bar1); gTask1DetailProgressControl = new ProgressControl(task1_lb_progress_label2, task1_pb_progress_bar2); }
private void Progreso(ProgressControl obj, string title, long n, long totalLines) { long porcentaje; obj.Label1.Text = title; if (n == 0) { obj.Label2.Text = "0%"; } else { porcentaje = (n * 100) / (double)totalLines; obj.Label2.Text = Convert.ToString(porcentaje) + "%"; obj.ProgressBar1.Value = Convert.ToString(porcentaje); } }
public void Encriptacion(string llavePublica, ref ProgressControl obj2) { long[] p; string texto, linea; string[] arrayPalabras, arrayNumeros, arrayCodigo; int n; texto = ""; linea = ""; p = toDec(llavePublica); if (validar_encriptado(p) == true) { fileName = leer_archivo(); contarLineas(rootFile); obj2.Show(); obj1.GroupBox1.Visible = true; n = 0; while (!FileSystem.EOF(1)) { Progreso(obj2, "Encriptando Archivo", n, numbersLine); arrayPalabras = Get_words(FileSystem.LineInput(1), " "); arrayNumeros = Translate2Number(arrayPalabras); arrayPalabras = null; arrayCodigo = Number2Code(p[0], p[1], arrayNumeros); arrayNumeros = null; linea = NewLine(arrayCodigo, "@"); arrayCodigo = null; texto += linea + Constants.vbNewLine; n = n + 1; } Cerrar_Archivo(texto); } }
private void Start_Click(object sender, RoutedEventArgs e) { if (isStop == false) { isStop = true; startedTime = DateTime.Now; DispatcherTimerSetup(); Start.Content = "End Workout"; } else { isStop = false; dispatcherTimer.Stop(); demoDispatcher.Stop(); Hour.Text = "0:00:00"; Start.Content = "Start Workout"; ProgressControl.SetBarLength(0.0); ProgressAmount = 0.0; } }
protected override void instantiate <T>() { base.instantiate <KarapanGameControl>(); base.name = Name; userInputControl = gameObject.GetComponent <UserInputControl>(); playerControl = GameObject.Find("Player").GetComponent <KarapanPlayerControl>(); lifeControl = gameObject.GetComponent <KarapanLifeControl>(); speedControl = gameObject.GetComponent <KarapanSpeedControl>(); progressControl = gameObject.GetComponent <ProgressControl>(); playerControl = GameObject.Find("Player").GetComponent <KarapanPlayerControl>(); addSubController("LifeControl", lifeControl); addSubController("SpeedControl", speedControl); addSubController("PlayerControl", playerControl); addSubController("ProgressControl", progressControl); addSubController("UserInputControl", userInputControl); UnityEngine.Debug.Log(userInputControl); userInputControl.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.Space }, "TogglePause", delegate() { togglePause(); }, Input.GetKeyDown, 0.75F)); userInputControl.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.Slash }, "DEBUG", delegate() { toggleDebug(); }, Input.GetKeyDown, UserInputControl.SeldomtimePress)); userInputControl.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.Equals }, "reset", delegate() { gameOver(); resetGame(); }, Input.GetKeyDown, UserInputControl.SometimePress)); }
public void ProcessRequest(HttpContext context) { bool first = true; context.Response.Write("["); if (context.Session != null && !String.IsNullOrEmpty(context.Session.SessionID)) { foreach (ProgressEvent e in ProgressControl.GetEvents(context.Session.SessionID)) { if (first) { context.Response.Write(e.ToString()); first = false; } else { context.Response.Write(", " + e.ToString()); } } } context.Response.Write("]"); }
public View3DTextCreator(Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape) { boldTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationSans-Bold.svg"))); MeshGroupExtraData = new List <PlatingMeshGroupData>(); FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape); meshViewerWidget.AllowBedRenderingWhenEmpty = true; meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPanel(viewerVolume.y); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); processingProgressControl = new ProgressControl("Finding Parts:".Localize(), ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; editPlateButtonsContainer = new FlowLayoutWidget(); textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter Text Here".Localize()); textToAddWidget.VAnchor = VAnchor.ParentCenter; textToAddWidget.Margin = new BorderDouble(5); editPlateButtonsContainer.AddChild(textToAddWidget); textToAddWidget.ActualTextEditWidget.EnterPressed += (object sender, KeyEventArgs keyEvent) => { InsertTextNow(textToAddWidget.Text); }; Button insertTextButton = textImageButtonFactory.Generate("Insert".Localize()); editPlateButtonsContainer.AddChild(insertTextButton); insertTextButton.Click += (sender, e) => { InsertTextNow(textToAddWidget.Text); }; KeyDown += (sender, e) => { KeyEventArgs keyEvent = e as KeyEventArgs; if (keyEvent != null && !keyEvent.Handled) { if (keyEvent.KeyCode == Keys.Escape) { if (meshSelectInfo.downOnPart) { meshSelectInfo.downOnPart = false; ScaleRotateTranslate translated = SelectedMeshTransform; translated.translation *= transformOnMouseDown; SelectedMeshTransform = translated; Invalidate(); } } } }; editToolBar.AddChild(editPlateButtonsContainer); buttonBottomPanel.AddChild(editToolBar); } GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); viewControls3D = new ViewControls3D(meshViewerWidget); viewControls3D.ResetView += (sender, e) => { SetDefaultView(); }; buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); closeButton = textImageButtonFactory.Generate("Close".Localize()); buttonBottomPanel.AddChild(closeButton); mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(viewControls3D); SetDefaultView(); AddHandlers(); UnlockEditControls(); // but make sure we can't use the right panel yet buttonRightPanelDisabledCover.Visible = true; }
public View3DTransformPart(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, MeshViewerWidget.BedShape bedShape) { MeshExtraData = new List<PlatingMeshData>(); MeshExtraData.Add(new PlatingMeshData()); this.printItemWrapper = printItemWrapper; FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, 1, bedShape); SetMeshViewerDisplayTheme(); meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); meshViewerWidget.LoadMesh(printItemWrapper.FileLocation); meshViewerWidget.LoadDone += new EventHandler(meshViewerWidget_LoadDone); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPannel(viewerVolume.y); CreateOptionsContent(); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); string progressFindPartsLbl = new LocalizedString ("Finding Parts").Translated; string progressFindPartsLblFull = string.Format ("{0}:", progressFindPartsLbl); processingProgressControl = new ProgressControl(progressFindPartsLblFull); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; processingProgressControl.Visible = false; editPlateButton = textImageButtonFactory.Generate(new LocalizedString("Edit").Translated); editToolBar.AddChild(editPlateButton); editPlateButtonsContainer = new FlowLayoutWidget(); editPlateButtonsContainer.Visible = false; Button addButton = textImageButtonFactory.Generate(new LocalizedString("Add").Translated, "icon_circle_plus.png"); addButton.Margin = new BorderDouble(right: 10); editPlateButtonsContainer.AddChild(addButton); addButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file|*.stl", multiSelect: true); FileDialog.OpenFileDialog(ref openParams); LoadAndAddPartsToPlate(openParams.FileNames); }); }; Button copyButton = textImageButtonFactory.Generate(new LocalizedString("Copy").Translated); editPlateButtonsContainer.AddChild(copyButton); copyButton.Click += (sender, e) => { MakeCopyOfMesh(); }; Button deleteButton = textImageButtonFactory.Generate(new LocalizedString("Delete").Translated); deleteButton.Margin = new BorderDouble(left: 20); editPlateButtonsContainer.AddChild(deleteButton); deleteButton.Click += (sender, e) => { DeleteSelectedMesh(); }; KeyDown += (sender, e) => { KeyEventArgs keyEvent = e as KeyEventArgs; if (keyEvent != null && !keyEvent.Handled) { if (keyEvent.KeyCode == Keys.Delete || keyEvent.KeyCode == Keys.Back) { DeleteSelectedMesh(); } if (keyEvent.KeyCode == Keys.Escape) { if (meshSelectInfo.downOnPart) { meshSelectInfo.downOnPart = false; SelectedMeshTransform = transformOnMouseDown; Invalidate(); } } } }; editToolBar.AddChild(editPlateButtonsContainer); buttonBottomPanel.AddChild(editToolBar); editPlateButton.Click += (sender, e) => { editPlateButton.Visible = false; EnterEditAndSplitIntoMeshes(); }; } autoArrangeButton.Click += (sender, e) => { AutoArangePartsInBackground(); }; GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); closeButton = textImageButtonFactory.Generate(new LocalizedString("Close").Translated); buttonBottomPanel.AddChild(closeButton); mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddViewControls(); AddHandlers(); }
public void AddProgress(ProgressControl progress) { progressQueue.Add(progress); }
void annotationCanvas_SaveAnnotation(Obany.Render.Objects.Canvas canvas, string mimeType) { _progressControl = new ProgressControl(); AddWatermark(canvas); string files = CultureHelper.GetString(Properties.Resources.ResourceManager, "FILES"); string allFiles = CultureHelper.GetString(Properties.Resources.ResourceManager, "ALLFILES"); string ext = ""; string filter = ""; if (mimeType == "image/jpeg") { ext += ".jpg"; filter = "Jpg " + files + " (*.jpg)|*.jpg"; _progressControl.Status = CultureHelper.GetString(Properties.Resources.ResourceManager, "CREATING") + " Jpg"; } else if (mimeType == "application/vnd.ms-xpsdocument") { ext += ".xps"; filter = "Xps " + files + " (*.xps)|*.xps"; _progressControl.Status = CultureHelper.GetString(Properties.Resources.ResourceManager, "CREATING") + " Xps"; } else if (mimeType == "application/pdf") { ext += ".pdf"; filter = "Pdf " + files + " (*.pdf)|*.pdf"; _progressControl.Status = CultureHelper.GetString(Properties.Resources.ResourceManager, "CREATING") + " Pdf"; } filter += "|" + allFiles + " (*.*)|*.*"; #if SILVERLIGHT SaveFileDialog saveFileDialog = new SaveFileDialog(); #else Microsoft.Win32.SaveFileDialog saveFileDialog = new Microsoft.Win32.SaveFileDialog(); if (!string.IsNullOrEmpty(_lastSavePath)) { saveFileDialog.InitialDirectory = _lastSavePath; } #endif saveFileDialog.DefaultExt = ext; saveFileDialog.Filter = filter; if (saveFileDialog.ShowDialog().Value) { #if !SILVERLIGHT _lastSavePath = System.IO.Path.GetDirectoryName(saveFileDialog.FileName); #endif System.IO.Stream saveStream = saveFileDialog.OpenFile(); DialogPanel.ShowDialog(Properties.Resources.ResourceManager, "PROGRESS", _progressControl, "buttonCancel", DialogButtons.Cancel, delegate(DialogResult dialogControlResult) { _progressControl = null; } ); _saveTaskId = Guid.NewGuid(); _coreLogic.AnnotationSave(_saveTaskId, saveStream, canvas, mimeType, delegate(bool success, Guid saveTaskIdComplete) { Action a = delegate() { if (_saveTaskId == saveTaskIdComplete) { if (!success) { DialogPanel.ShowInformationBox(CultureHelper.GetString(Properties.Resources.ResourceManager, "ANNOTATIONUNABLETOSAVE"), DialogButtons.Ok, null); } else { if (annotationCanvas != null) { annotationCanvas.ResetChanges(); } } if (_progressControl != null) { DialogPanel.Close(_progressControl, DialogResult.Close); } _saveTaskId = Guid.Empty; } }; #if SILVERLIGHT Dispatcher.BeginInvoke(a); #else Dispatcher.Invoke(a); #endif }); } }
public View3DTransformPart(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowType windowType, AutoRotate autoRotate) { this.windowType = windowType; autoRotateEnabled = (autoRotate == AutoRotate.Enabled); MeshExtraData = new List<PlatingMeshData>(); MeshExtraData.Add(new PlatingMeshData()); this.printItemWrapper = printItemWrapper; FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape, "Press 'Add' to select an item.".Localize()); // this is to add an image to the bed string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "OEMSettings", "bedimage.png"); if (autoRotateEnabled && File.Exists(imagePathAndFile)) { ImageBuffer wattermarkImage = new ImageBuffer(); ImageIO.LoadImageData(imagePathAndFile, wattermarkImage); ImageBuffer bedImage = meshViewerWidget.BedImage; Graphics2D bedGraphics = bedImage.NewGraphics2D(); bedGraphics.Render(wattermarkImage, new Vector2((bedImage.Width - wattermarkImage.Width) / 2, (bedImage.Height - wattermarkImage.Height)/2)); } meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPanel(viewerVolume.y); CreateOptionsContent(); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); string progressFindPartsLabel = LocalizedString.Get("Finding Parts"); string progressFindPartsLabelFull = "{0}:".FormatWith(progressFindPartsLabel); processingProgressControl = new ProgressControl(progressFindPartsLabelFull, ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; processingProgressControl.Visible = false; // If the window is embeded (in the center pannel) and there is no item loaded then don't show the add button enterEditButtonsContainer = new FlowLayoutWidget(); { Button addButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); addButton.Margin = new BorderDouble(right: 10); enterEditButtonsContainer.AddChild(addButton); addButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { EnterEditAndSplitIntoMeshes(); OpenAddDialogWhenDone = true; }); }; Button enterEdittingButton = textImageButtonFactory.Generate(LocalizedString.Get("Edit")); enterEdittingButton.Click += (sender, e) => { EnterEditAndSplitIntoMeshes(); }; enterEditButtonsContainer.AddChild(enterEdittingButton); } editToolBar.AddChild(enterEditButtonsContainer); doEdittingButtonsContainer = new FlowLayoutWidget(); doEdittingButtonsContainer.Visible = false; { Button addButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); addButton.Margin = new BorderDouble(right: 10); doEdittingButtonsContainer.AddChild(addButton); addButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { OpenFileDialogParams openParams = new OpenFileDialogParams("Select an STL file|*.stl", multiSelect: true); FileDialog.OpenFileDialog(ref openParams); LoadAndAddPartsToPlate(openParams.FileNames); }); }; Button copyButton = textImageButtonFactory.Generate(LocalizedString.Get("Copy")); doEdittingButtonsContainer.AddChild(copyButton); copyButton.Click += (sender, e) => { MakeCopyOfMesh(); }; Button deleteButton = textImageButtonFactory.Generate(LocalizedString.Get("Delete")); deleteButton.Margin = new BorderDouble(left: 20); doEdittingButtonsContainer.AddChild(deleteButton); deleteButton.Click += (sender, e) => { DeleteSelectedMesh(); }; } KeyDown += (sender, e) => { KeyEventArgs keyEvent = e as KeyEventArgs; if (keyEvent != null && !keyEvent.Handled) { if (keyEvent.KeyCode == Keys.Delete || keyEvent.KeyCode == Keys.Back) { DeleteSelectedMesh(); } if (keyEvent.KeyCode == Keys.Escape) { if (meshSelectInfo.downOnPart) { meshSelectInfo.downOnPart = false; ScaleRotateTranslate translated = SelectedMeshTransform; translated.translation *= transformOnMouseDown; SelectedMeshTransform = translated; Invalidate(); } } } }; editToolBar.AddChild(doEdittingButtonsContainer); buttonBottomPanel.AddChild(editToolBar); } autoArrangeButton.Click += (sender, e) => { AutoArangePartsInBackground(); }; GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); viewControls3D = new ViewControls3D(meshViewerWidget); buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); if (windowType == WindowType.StandAlone) { Button closeButton = textImageButtonFactory.Generate(LocalizedString.Get("Close")); buttonBottomPanel.AddChild(closeButton); closeButton.Click += (sender, e) => { CloseOnIdle(); }; } mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(viewControls3D); viewControls3D.PartSelectVisible = false; AddHandlers(); if (printItemWrapper != null) { // don't load the mesh until we get all the rest of the interface built meshViewerWidget.LoadMesh(printItemWrapper.FileLocation); meshViewerWidget.LoadDone += new EventHandler(meshViewerWidget_LoadDone); } UiThread.RunOnIdle(AutoSpin); if (printItemWrapper == null && windowType == WindowType.Embeded) { enterEditButtonsContainer.Visible = false; } if (windowType == WindowType.Embeded) { PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents); if (windowType == WindowType.Embeded) { // make sure we lock the controls if we are printing or paused switch (PrinterConnectionAndCommunication.Instance.CommunicationState) { case PrinterConnectionAndCommunication.CommunicationStates.Printing: case PrinterConnectionAndCommunication.CommunicationStates.Paused: LockEditControls(); break; } } } ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents); }
private void ImportTranslations() { var lm = new LogManager(GetType()); if (File.Exists(lm.FilePath)) { if (MessageBox.Show(this, @"A log file already exists. Would you like to create a new log file?", @"Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { File.Copy(lm.FilePath, $"{lm.FilePath.Substring(0, lm.FilePath.Length - 4)}-{DateTime.Now:yyyyMMdd_HHmmss}.txt", true); File.Delete(lm.FilePath); } } numberOferrors = 0; pbOverall.ForeColor = SystemColors.Highlight; SetState(true); BaseTranslation.BulkCount = (int)nudBatchCount.Value; WorkAsync(new WorkAsyncInfo { Message = "", AsyncArgument = txtFilePath.Text, Work = (bw, e) => { var engine = new Engine(); engine.OnLog += (sender, evt) => { if (evt.Type == LogType.Error) { LogError(evt.Message); } else if (evt.Type == LogType.Warning) { LogWarning(evt.Message); } else { LogInfo(evt.Message); } }; engine.OnProgress += (sender, evt) => { Invoke(new Action(() => { if (string.IsNullOrEmpty(evt.SheetName)) { currentControl?.End(currentControl.Error == 0); return; } if (currentControl == null || currentControl.SheetName != evt.SheetName) { currentControl?.End(currentControl.Error == 0); currentControl = new ProgressControl(evt.SheetName); currentControl.Dock = DockStyle.Top; pnlNewProgress.Controls.Add(currentControl); pnlNewProgress.Controls.SetChildIndex(currentControl, 0); pnlNewProgress.ScrollControlIntoView(currentControl); } currentControl.Count = evt.TotalItems; currentControl.Error = evt.FailureCount; currentControl.Success = evt.SuccessCount; })); }; engine.Import(e.Argument.ToString(), Service, bw); }, PostWorkCallBack = e => { if (e.Error != null) { string errorMessage = CrmExceptionHelper.GetErrorMessage(e.Error, true); MessageBox.Show(this, errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } SetState(false); lblProgress.Text = ""; if (File.Exists(lm.FilePath)) { llOpenLog.Visible = true; } }, ProgressChanged = e => { if (e.UserState is ProgressInfo pInfo) { lblProgress.Text = pInfo.Message; if (numberOferrors > 0) { pbOverall.ForeColor = Color.Red; pbOverall.Invalidate(); llOpenLog.Visible = true; } if (pInfo.Overall != 0) { pbOverall.Value = pInfo.Overall > pbOverall.Maximum ? pbOverall.Maximum : pInfo.Overall; } } else { SetWorkingMessage(e.UserState.ToString()); } } });
void IProgressControlHost.Host(ProgressControl progressControl) { Assert.IsNotNull(progressControl); this.progressControl = progressControl; }
public View3DBrailleBuilder(Vector3 viewerVolume, Vector2 bedCenter, BedShape bedShape) { monoSpacedTypeFace = ApplicationController.MonoSpacedTypeFace; brailTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "Braille.svg"))); MeshGroupExtraData = new List<PlatingMeshGroupData>(); FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape); meshViewerWidget.AllowBedRenderingWhenEmpty = true; meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPanel(viewerVolume.y); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); processingProgressControl = new ProgressControl("Finding Parts:".Localize(), ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; editPlateButtonsContainer = new FlowLayoutWidget(); textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter Text Here".Localize()); textToAddWidget.VAnchor = VAnchor.ParentCenter; textToAddWidget.Margin = new BorderDouble(5); editPlateButtonsContainer.AddChild(textToAddWidget); textToAddWidget.ActualTextEditWidget.EnterPressed += (object sender, KeyEventArgs keyEvent) => { InsertTextNow(textToAddWidget.Text); }; Button insertTextButton = textImageButtonFactory.Generate("Insert".Localize()); editPlateButtonsContainer.AddChild(insertTextButton); insertTextButton.Click += (sender, e) => { InsertTextNow(textToAddWidget.Text); }; editToolBar.AddChild(editPlateButtonsContainer); buttonBottomPanel.AddChild(editToolBar); } GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); viewControls3D = new ViewControls3D(meshViewerWidget); viewControls3D.ResetView += (sender, e) => { meshViewerWidget.ResetView(); }; buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); closeButton = textImageButtonFactory.Generate("Close".Localize()); buttonBottomPanel.AddChild(closeButton); mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(viewControls3D); // set the view to be a good angle and distance meshViewerWidget.ResetView(); AddHandlers(); UnlockEditControls(); // but make sure we can't use the right panel yet buttonRightPanelDisabledCover.Visible = true; //meshViewerWidget.RenderType = RenderTypes.Outlines; viewControls3D.PartSelectVisible = false; meshViewerWidget.ResetView(); }
public View3DBrailleBuilder(Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape) { boldTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationMono.svg"))); brailTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "Braille.svg"))); MeshGroupExtraData = new List <PlatingMeshGroupData>(); FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape); meshViewerWidget.AllowBedRenderingWhenEmpty = true; meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPanel(viewerVolume.y); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); processingProgressControl = new ProgressControl("Finding Parts:".Localize(), ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; editPlateButtonsContainer = new FlowLayoutWidget(); textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter Text Here".Localize()); textToAddWidget.VAnchor = VAnchor.ParentCenter; textToAddWidget.Margin = new BorderDouble(5); editPlateButtonsContainer.AddChild(textToAddWidget); textToAddWidget.ActualTextEditWidget.EnterPressed += (object sender, KeyEventArgs keyEvent) => { InsertTextNow(textToAddWidget.Text); }; Button insertTextButton = textImageButtonFactory.Generate("Insert".Localize()); editPlateButtonsContainer.AddChild(insertTextButton); insertTextButton.Click += (sender, e) => { InsertTextNow(textToAddWidget.Text); }; editToolBar.AddChild(editPlateButtonsContainer); buttonBottomPanel.AddChild(editToolBar); } GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); viewControls3D = new ViewControls3D(meshViewerWidget); buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); closeButton = textImageButtonFactory.Generate("Close".Localize()); buttonBottomPanel.AddChild(closeButton); mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(viewControls3D); // set the view to be a good angle and distance meshViewerWidget.TrackballTumbleWidget.TrackBallController.Scale = .06; meshViewerWidget.TrackballTumbleWidget.TrackBallController.Rotate(Quaternion.FromEulerAngles(new Vector3(-MathHelper.Tau * .02, 0, 0))); meshViewerWidget.TrackballTumbleWidget.TrackBallController.Translate(-new Vector3(bedCenter)); AddHandlers(); UnlockEditControls(); // but make sure we can't use the right panel yet buttonRightPanelDisabledCover.Visible = true; //meshViewerWidget.RenderType = RenderTypes.Outlines; viewControls3D.PartSelectVisible = false; }
private void InitializeComponent() { EnableDragging = false; Bounds = new UniRectangle ( new UniScalar(1.0f, -400.0f), new UniScalar(0.0f, 0.0f), new UniScalar(0.0f, 400.0f), new UniScalar(0.0f, 130.0f) ); _name = new LabelControl(); _class = new LabelControl(); _health = new LabelControl(); _mana = new LabelControl(); _healthBar = new ProgressControl(); _manaBar = new ProgressControl(); _name.Bounds = new UniRectangle ( new UniScalar(0.0f, 15.0f), new UniScalar(0.0f, 10.0f), new UniScalar(0.5f, -15.0f), new UniScalar(0.0f, 30.0f) ); _name.Text = "Name"; Children.Add(_name); _class.Bounds = new UniRectangle ( new UniScalar(0.5f, 15.0f), new UniScalar(0.0f, 10.0f), new UniScalar(0.5f, -15.0f), new UniScalar(0.0f, 30.0f) ); _class.Text = "Class"; Children.Add(_class); _health.Bounds = new UniRectangle ( new UniScalar(1.0f, -70f), new UniScalar(1.0f, -80.0f), new UniScalar(0.0f, 60f), new UniScalar(0.0f, 30.0f) ); _health.Text = "50 HP"; Children.Add(_health); _mana.Bounds = new UniRectangle ( new UniScalar(1.0f, -70f), new UniScalar(1.0f, -40.0f), new UniScalar(0.0f, 60f), new UniScalar(0.0f, 30.0f) ); _mana.Text = "20 SP"; Children.Add(_mana); _healthBar.Bounds = new UniRectangle ( new UniScalar(0.0f, 10.0f), new UniScalar(1.0f, -80.0f), new UniScalar(1.0f, -100.0f), new UniScalar(0.0f, 30.0f) ); _healthBar.Progress = 1.0f; Children.Add(_healthBar); _manaBar.Bounds = new UniRectangle ( new UniScalar(0.0f, 10.0f), new UniScalar(1.0f, -40.0f), new UniScalar(1.0f, -100.0f), new UniScalar(0.0f, 30.0f) ); _manaBar.Progress = 1.0f; Children.Add(_manaBar); }
void IProgressControlHost.Host(ProgressControl progressControl) { progressControl.Should().NotBeNull(); this.ProgressControl = progressControl; }
public View3DTextCreator(Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape) { boldTypeFace = TypeFace.LoadFrom(StaticData.Instance.ReadAllText(Path.Combine("Fonts", "LiberationSans-Bold.svg"))); MeshGroupExtraData = new List<PlatingMeshGroupData>(); FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape); meshViewerWidget.AllowBedRenderingWhenEmpty = true; meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPanel(viewerVolume.y); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); processingProgressControl = new ProgressControl("Finding Parts:".Localize(), ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; editPlateButtonsContainer = new FlowLayoutWidget(); MHTextEditWidget textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter Text Here".Localize()); textToAddWidget.VAnchor = VAnchor.ParentCenter; textToAddWidget.Margin = new BorderDouble(5); editPlateButtonsContainer.AddChild(textToAddWidget); textToAddWidget.ActualTextEditWidget.EnterPressed += (object sender, KeyEventArgs keyEvent) => { InsertTextNow(textToAddWidget.Text); }; Button insertTextButton = textImageButtonFactory.Generate("Insert".Localize()); editPlateButtonsContainer.AddChild(insertTextButton); insertTextButton.Click += (sender, e) => { InsertTextNow(textToAddWidget.Text); }; KeyDown += (sender, e) => { KeyEventArgs keyEvent = e as KeyEventArgs; if (keyEvent != null && !keyEvent.Handled) { if (keyEvent.KeyCode == Keys.Escape) { if (meshSelectInfo.downOnPart) { meshSelectInfo.downOnPart = false; ScaleRotateTranslate translated = SelectedMeshTransform; translated.translation *= transformOnMouseDown; SelectedMeshTransform = translated; Invalidate(); } } } }; editToolBar.AddChild(editPlateButtonsContainer); buttonBottomPanel.AddChild(editToolBar); } GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); viewControls3D = new ViewControls3D(meshViewerWidget); buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); closeButton = textImageButtonFactory.Generate("Close".Localize()); buttonBottomPanel.AddChild(closeButton); mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(viewControls3D); // set the view to be a good angle and distance meshViewerWidget.TrackballTumbleWidget.TrackBallController.Scale = .06; meshViewerWidget.TrackballTumbleWidget.TrackBallController.Rotate(Quaternion.FromEulerAngles(new Vector3(-MathHelper.Tau * .02, 0, 0))); AddHandlers(); UnlockEditControls(); // but make sure we can't use the right panel yet buttonRightPanelDisabledCover.Visible = true; }
void IProgressControlHost.Host(ProgressControl progressControl) { this.HostProgressControl(progressControl); }
private void OpenAnnotationViewer() { annotationCanvas.ClearContent(); Transition(contentPresenterSearchVisualise, annotationCanvas); annotationCanvas.Title = _currentSearchVisualisation.CurrentSearchAggregateItem.Title; _progressControl = new ProgressControl(); _progressControl.Status = CultureHelper.GetString(Properties.Resources.ResourceManager, "RENDERING") + "..."; DialogPanel.ShowDialog(Properties.Resources.ResourceManager, "PROGRESS", _progressControl, "buttonCancel", DialogButtons.Cancel, delegate(DialogResult dialogControlResult) { _progressControl = null; if (dialogControlResult == DialogResult.Cancel) { CloseAnnotationViewer(); } } ); string annotateUrl = _currentSearchVisualisation.CurrentSearchAggregateItem.ContentUrl; bool showHeader = false; if (string.IsNullOrEmpty(annotateUrl)) { showHeader = true; annotateUrl = _currentSearchVisualisation.CurrentSearchAggregateItem.OpenUrl; } _renderTaskId = Guid.NewGuid(); _coreLogic.AnnotationRenderWebPage(_renderTaskId, annotateUrl, delegate(bool success, Guid renderTaskIdComplete, byte[] imageData, int imageWidth, int imageHeight, string imageMimeType, string renderDataId) { Action a = delegate() { if (_renderTaskId == renderTaskIdComplete) { if (!success) { DialogPanel.ShowInformationBox(CultureHelper.GetString(Properties.Resources.ResourceManager, "ANNOTATIONUNABLETORETRIEVESEARCHRESULT"), DialogButtons.Ok, null); } else { if (annotationCanvas != null) { if (showHeader) { annotationCanvas.SetupCanvas(imageWidth + 40, imageHeight + 80); if (_currentSearchVisualisation != null) { annotationCanvas.AddText(_currentSearchVisualisation.CurrentSearchAggregateItem.Title + " [" + _currentSearchVisualisation.CurrentSearchAggregateItem.OpenUrl + "]", 14, "Arial", 20, 20); } annotationCanvas.AddRectangle(Color.FromArgb(0xFF, 0x99, 0x99, 0x99), imageWidth, 2, 20, 42); annotationCanvas.AddBitmapImage(imageData, imageWidth, imageHeight, imageMimeType, renderDataId, 20, 60); } else { annotationCanvas.SetupCanvas(imageWidth, imageHeight); annotationCanvas.AddBitmapImage(imageData, imageWidth, imageHeight, imageMimeType, renderDataId, 0, 0); } } } if (_progressControl != null) { DialogPanel.Close(_progressControl, success ? DialogResult.Ok : DialogResult.Cancel); } _renderTaskId = Guid.Empty; } }; #if SILVERLIGHT Dispatcher.BeginInvoke(a); #else Dispatcher.Invoke(a); #endif } ); }
protected virtual void HostProgressControl(ProgressControl control) { this.progressPlacePlaceholder.Content = control; }
private void ShowSearchResultProgressDialog(string initialStatus) { _progressControl = new ProgressControl(); _progressControl.Status = initialStatus; DialogPanel.ShowDialog(Properties.Resources.ResourceManager, "PROGRESS", _progressControl, "buttonCancel", DialogButtons.Cancel, delegate(DialogResult dialogControlResult) { _progressControl = null; if (dialogControlResult == DialogResult.Cancel) { CleanupSearchVisualisation(); } } ); }
private void AddLoadingProgressBar() { processingProgressControl = new ProgressControl("Downloading...".Localize(), RGBA_Bytes.Black, ActiveTheme.Instance.SecondaryAccentColor, (int)(100 * TextWidget.GlobalPointSizeScaleRatio), 5, 0) { PointSize = 8, }; //processingProgressControl.BackgroundColor = RGBA_Bytes.White; processingProgressControl.VAnchor = VAnchor.ParentBottom; processingProgressControl.HAnchor = HAnchor.ParentLeft; processingProgressControl.Margin = new BorderDouble(0); processingProgressControl.Visible = false; middleColumn.AddChild(processingProgressControl); }
internal void AnnotationShare(string provider, Obany.Render.Objects.Canvas canvas) { ShumbiDiscover.Controls.Dialogs.DocumentInformation documentInformationDialog = new ShumbiDiscover.Controls.Dialogs.DocumentInformation(); documentInformationDialog.Title = _currentSearchVisualisation.CurrentSearchAggregateItem.Title; documentInformationDialog.IsPublic = true; documentInformationDialog.Keywords = ""; AddWatermark(canvas); DialogPanel.ShowDialog(Properties.Resources.ResourceManager, "ANNOTATIONNFORMATION", documentInformationDialog, "buttonOK", DialogButtons.Ok | DialogButtons.Cancel, delegate(DialogResult dialogControlResult) { if (dialogControlResult == DialogResult.Ok) { _progressControl = new ProgressControl(); _progressControl.Status = CultureHelper.GetString(Properties.Resources.ResourceManager, "ANNOTATIONSENDINGTO").Replace("%1", provider); DialogPanel.ShowDialog(Properties.Resources.ResourceManager, "PROGRESS", _progressControl, "buttonCancel", DialogButtons.Cancel, delegate(DialogResult dialogControlResult2) { _progressControl = null; } ); _shareTaskId = Guid.NewGuid(); _coreLogic.AnnotationShare(_shareTaskId, provider, canvas, documentInformationDialog.Title, documentInformationDialog.IsPublic, documentInformationDialog.Keywords, delegate(bool success, Guid shareTaskCompleteId, Uri providerUrl) { Action a = delegate() { // Only do the completion operations if this is the current task if (_shareTaskId == shareTaskCompleteId) { if (!success) { DialogPanel.ShowInformationBox(CultureHelper.GetString(Properties.Resources.ResourceManager, "ANNOTATIONUNABLETOSEND").Replace("%1", provider), DialogButtons.Ok, null); } else { ShumbiDiscover.Controls.Dialogs.DocumentComplete documentCompleteDialog = new ShumbiDiscover.Controls.Dialogs.DocumentComplete(); documentCompleteDialog.Url = providerUrl.ToString(); documentCompleteDialog.OpenUrlRequested += new ShumbiDiscover.Controls.Dialogs.DocumentComplete.OpenUrlRequestedEventHandler(OpenUrl); DialogPanel.ShowDialog(Properties.Resources.ResourceManager, "ANNOTATIONSENDCOMPLETE", documentCompleteDialog, "buttonOK", DialogButtons.Ok, null); } if (_progressControl != null) { DialogPanel.Close(_progressControl, success ? DialogResult.Ok : DialogResult.Cancel); _progressControl = null; } _shareTaskId = Guid.Empty; } }; #if SILVERLIGHT Dispatcher.BeginInvoke(a); #else Dispatcher.Invoke(a); #endif } ); } } ); }
public View3DWidget(PrintItemWrapper printItemWrapper, Vector3 viewerVolume, Vector2 bedCenter, MeshViewerWidget.BedShape bedShape, WindowMode windowType, AutoRotate autoRotate, OpenMode openMode = OpenMode.Viewing) { this.openMode = openMode; this.windowType = windowType; allowAutoRotate = (autoRotate == AutoRotate.Enabled); autoRotating = allowAutoRotate; MeshGroupExtraData = new List<PlatingMeshGroupData>(); MeshGroupExtraData.Add(new PlatingMeshGroupData()); this.printItemWrapper = printItemWrapper; FlowLayoutWidget mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); mainContainerTopToBottom.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth; mainContainerTopToBottom.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight; FlowLayoutWidget centerPartPreviewAndControls = new FlowLayoutWidget(FlowDirection.LeftToRight); centerPartPreviewAndControls.Name = "centerPartPreviewAndControls"; centerPartPreviewAndControls.AnchorAll(); GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { meshViewerWidget = new MeshViewerWidget(viewerVolume, bedCenter, bedShape, "Press 'Add' to select an item.".Localize()); PutOemImageOnBed(); meshViewerWidget.AnchorAll(); } viewArea.AddChild(meshViewerWidget); centerPartPreviewAndControls.AddChild(viewArea); mainContainerTopToBottom.AddChild(centerPartPreviewAndControls); FlowLayoutWidget buttonBottomPanel = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonBottomPanel.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.Padding = new BorderDouble(3, 3); buttonBottomPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel = CreateRightButtonPanel(viewerVolume.y); buttonRightPanel.Name = "buttonRightPanel"; buttonRightPanel.Visible = false; CreateOptionsContent(); // add in the plater tools { FlowLayoutWidget editToolBar = new FlowLayoutWidget(); string progressFindPartsLabel = "Entering Editor".Localize(); string progressFindPartsLabelFull = "{0}:".FormatWith(progressFindPartsLabel); processingProgressControl = new ProgressControl(progressFindPartsLabelFull, ActiveTheme.Instance.PrimaryTextColor, ActiveTheme.Instance.PrimaryAccentColor); processingProgressControl.VAnchor = Agg.UI.VAnchor.ParentCenter; editToolBar.AddChild(processingProgressControl); editToolBar.VAnchor |= Agg.UI.VAnchor.ParentCenter; processingProgressControl.Visible = false; // If the window is embeded (in the center pannel) and there is no item loaded then don't show the add button enterEditButtonsContainer = new FlowLayoutWidget(); { Button addButton = textImageButtonFactory.Generate("Insert".Localize(), "icon_insert_32x32.png"); addButton.ToolTipText = "Insert an .stl, .amf or .zip file".Localize(); addButton.Margin = new BorderDouble(right: 0); enterEditButtonsContainer.AddChild(addButton); addButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { DoAddFileAfterCreatingEditData = true; EnterEditAndCreateSelectionData(); }); }; if (printItemWrapper != null && printItemWrapper.PrintItem.ReadOnly) { addButton.Enabled = false; } Button enterEdittingButton = textImageButtonFactory.Generate("Edit".Localize(), "icon_edit_32x32.png"); enterEdittingButton.Margin = new BorderDouble(right: 4); enterEdittingButton.Click += (sender, e) => { EnterEditAndCreateSelectionData(); }; if (printItemWrapper != null && printItemWrapper.PrintItem.ReadOnly) { enterEdittingButton.Enabled = false; } Button exportButton = textImageButtonFactory.Generate("Export...".Localize()); if (printItemWrapper != null && (printItemWrapper.PrintItem.Protected || printItemWrapper.PrintItem.ReadOnly)) { exportButton.Enabled = false; } exportButton.Margin = new BorderDouble(right: 10); exportButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { OpenExportWindow(); }); }; enterEditButtonsContainer.AddChild(enterEdittingButton); enterEditButtonsContainer.AddChild(exportButton); } editToolBar.AddChild(enterEditButtonsContainer); doEdittingButtonsContainer = new FlowLayoutWidget(); doEdittingButtonsContainer.Visible = false; { Button addButton = textImageButtonFactory.Generate("Insert".Localize(), "icon_insert_32x32.png"); addButton.Margin = new BorderDouble(right: 10); doEdittingButtonsContainer.AddChild(addButton); addButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { FileDialog.OpenFileDialog( new OpenFileDialogParams(ApplicationSettings.OpenDesignFileParams, multiSelect: true), (openParams) => { LoadAndAddPartsToPlate(openParams.FileNames); }); }); }; GuiWidget separator = new GuiWidget(1, 2); separator.BackgroundColor = ActiveTheme.Instance.PrimaryTextColor; separator.Margin = new BorderDouble(4, 2); separator.VAnchor = VAnchor.ParentBottomTop; doEdittingButtonsContainer.AddChild(separator); Button ungroupButton = textImageButtonFactory.Generate("Ungroup".Localize()); doEdittingButtonsContainer.AddChild(ungroupButton); ungroupButton.Click += (sender, e) => { UngroupSelectedMeshGroup(); }; Button groupButton = textImageButtonFactory.Generate("Group".Localize()); doEdittingButtonsContainer.AddChild(groupButton); groupButton.Click += (sender, e) => { GroupSelectedMeshs(); }; Button alignButton = textImageButtonFactory.Generate("Align".Localize()); doEdittingButtonsContainer.AddChild(alignButton); alignButton.Click += (sender, e) => { AlignToSelectedMeshGroup(); }; Button arrangeButton = textImageButtonFactory.Generate("Arrange".Localize()); doEdittingButtonsContainer.AddChild(arrangeButton); arrangeButton.Click += (sender, e) => { AutoArrangePartsInBackground(); }; GuiWidget separatorTwo = new GuiWidget(1, 2); separatorTwo.BackgroundColor = ActiveTheme.Instance.PrimaryTextColor; separatorTwo.Margin = new BorderDouble(4, 2); separatorTwo.VAnchor = VAnchor.ParentBottomTop; doEdittingButtonsContainer.AddChild(separatorTwo); Button copyButton = textImageButtonFactory.Generate("Copy".Localize()); doEdittingButtonsContainer.AddChild(copyButton); copyButton.Click += (sender, e) => { MakeCopyOfGroup(); }; Button deleteButton = textImageButtonFactory.Generate("Remove".Localize()); doEdittingButtonsContainer.AddChild(deleteButton); deleteButton.Click += (sender, e) => { DeleteSelectedMesh(); }; GuiWidget separatorThree = new GuiWidget(1, 2); separatorThree.BackgroundColor = ActiveTheme.Instance.PrimaryTextColor; separatorThree.Margin = new BorderDouble(4, 1); separatorThree.VAnchor = VAnchor.ParentBottomTop; doEdittingButtonsContainer.AddChild(separatorThree); Button leaveEditModeButton = textImageButtonFactory.Generate("Cancel".Localize(), centerText: true); leaveEditModeButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { if (saveButtons.Visible) { StyledMessageBox.ShowMessageBox(ExitEditingAndSaveIfRequired, "Would you like to save your changes before exiting the editor?", "Save Changes", StyledMessageBox.MessageType.YES_NO); } else { if (partHasBeenEdited) { ExitEditingAndSaveIfRequired(false); } else { SwitchStateToNotEditing(); } } }); }; doEdittingButtonsContainer.AddChild(leaveEditModeButton); // put in the save button AddSaveAndSaveAs(doEdittingButtonsContainer); } KeyDown += (sender, e) => { KeyEventArgs keyEvent = e as KeyEventArgs; if (keyEvent != null && !keyEvent.Handled) { if (keyEvent.KeyCode == Keys.Delete || keyEvent.KeyCode == Keys.Back) { DeleteSelectedMesh(); } if (keyEvent.KeyCode == Keys.Escape) { if (meshSelectInfo.downOnPart) { meshSelectInfo.downOnPart = false; ScaleRotateTranslate translated = SelectedMeshGroupTransform; translated.translation = transformOnMouseDown; SelectedMeshGroupTransform = translated; Invalidate(); } } } }; editToolBar.AddChild(doEdittingButtonsContainer); buttonBottomPanel.AddChild(editToolBar); } GuiWidget buttonRightPanelHolder = new GuiWidget(HAnchor.FitToChildren, VAnchor.ParentBottomTop); buttonRightPanelHolder.Name = "buttonRightPanelHolder"; centerPartPreviewAndControls.AddChild(buttonRightPanelHolder); buttonRightPanelHolder.AddChild(buttonRightPanel); viewControls3D = new ViewControls3D(meshViewerWidget); buttonRightPanelDisabledCover = new Cover(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop); buttonRightPanelDisabledCover.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryBackgroundColor, 150); buttonRightPanelHolder.AddChild(buttonRightPanelDisabledCover); viewControls3D.PartSelectVisible = false; LockEditControls(); GuiWidget leftRightSpacer = new GuiWidget(); leftRightSpacer.HAnchor = HAnchor.ParentLeftRight; buttonBottomPanel.AddChild(leftRightSpacer); if (windowType == WindowMode.StandAlone) { Button closeButton = textImageButtonFactory.Generate("Close".Localize()); buttonBottomPanel.AddChild(closeButton); closeButton.Click += (sender, e) => { CloseOnIdle(); }; } mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); this.AnchorAll(); meshViewerWidget.TrackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation; AddChild(viewControls3D); AddHandlers(); UiThread.RunOnIdle(AutoSpin); if (printItemWrapper == null && windowType == WindowMode.Embeded) { enterEditButtonsContainer.Visible = false; } if (windowType == WindowMode.Embeded) { PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents); if (windowType == WindowMode.Embeded) { // make sure we lock the controls if we are printing or paused switch (PrinterConnectionAndCommunication.Instance.CommunicationState) { case PrinterConnectionAndCommunication.CommunicationStates.Printing: case PrinterConnectionAndCommunication.CommunicationStates.Paused: LockEditControls(); break; } } } ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents); upArrow = new UpArrow3D(this); heightDisplay = new HeightValueDisplay(this); heightDisplay.Visible = false; meshViewerWidget.interactionVolumes.Add(upArrow); // make sure the colors are set correctl ThemeChanged(this, null); saveButtons.VisibleChanged += (sender, e) => { partHasBeenEdited = true; }; }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); ProgressControl.SetBarLength(1.0); }