public void CenterPartInView() { gCodeRenderer = new GCodeRenderer(loadedGCode); RectangleDouble partBounds = loadedGCode.GetBounds(); Vector2 weightedCenter = loadedGCode.GetWeightedCenter(); unscaledRenderOffset = -weightedCenter; layerScale = Math.Min(Height / partBounds.Height, Width / partBounds.Width); Invalidate(); }
void initialLoading_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { SetGCodeAfterLoad((GCodeFile)e.Result); backgroundWorker = new BackgroundWorker(); backgroundWorker.WorkerReportsProgress = true; backgroundWorker.WorkerSupportsCancellation = true; backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(postLoadInitialization_ProgressChanged); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(postLoadInitialization_RunWorkerCompleted); backgroundWorker.DoWork += new DoWorkEventHandler(DoPostLoadInitialization); gCodeRenderer = new GCodeRenderer(loadedGCode); backgroundWorker.RunWorkerAsync(gCodeRenderer); }
private async void initialLoading_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { SetGCodeAfterLoad((GCodeFile)e.Result); gCodeRenderer = new GCodeRenderer(LoadedGCode); if (ActiveSliceSettings.Instance.PrinterSelected) { GCodeRenderer.ExtruderWidth = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.nozzle_diameter); } else { GCodeRenderer.ExtruderWidth = .4; } await Task.Run(() => DoPostLoadInitialization()); postLoadInitialization_RunWorkerCompleted(); }
private async void initialLoading_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { SetGCodeAfterLoad((GCodeFile)e.Result); gCodeRenderer = new GCodeRenderer(loadedGCode); await Task.Run(() => DoPostLoadInitialization()); postLoadInitialization_RunWorkerCompleted(); }