public void Initialize(BackgroundSettings settings) { this.horizontalScrollRate = settings.HorizontalScrollRate; this.verticalScrollRate = settings.VerticalScrollRate; this.scrollType = settings.Type; this.scrollDirection = settings.Direction; }
public void Dispose() { _subscriptionHandle.Unsubscribe(); BackgroundSettings.RemoveForegroundId(_id); Close(); _asyncLock.Dispose(); _subscriptionHandle.Dispose(); }
public MyViewModel() { // Initializes the Coordinate System Icon for the data binding. MyCoordinateSystemIcon = new CoordinateSystemIcon(); // Initializes the Origin Symbol for the data binding. MyOriginSymbol = OriginSymbol.GetDefaultOriginSymbol(); OsStyleType = originSymbolStyleType.Ball; // Initializes the Grids collection for the data binding. Grid grid = new Grid() { Step = 10, MajorLinesEvery = 4 }; MyGrids = new ObservableCollection <Grid> { grid }; // Initializes the ToolBar for the data binding. MyToolBars = new ObservableCollection <ToolBar>(new List <ToolBar>() { ToolBar.GetDefaultToolBar() }); MyToolBar.Position = ToolBar.positionType.HorizontalTopCenter; // Uses toolbar buttons count info to enable/disable the Add/Remove buttons _buttonsCount = MyToolBar.Buttons.Count; // Creates the command for the the Add/Remove buttons CreateAddToolbarButtonCommand(); CreateRemoveToolbarButtonCommand(); // Initializes the BackgroundSettings for the the data binding. MyBackgroundSettings = new BackgroundSettings(backgroundStyleType.Solid, Helper.ConvertColor("#FF434752"), System.Drawing.Color.White, Helper.ConvertColor("#FFEDEDED"), .75, null); // Sets the ViewModel's BackgroundStyle: in this way the "Background" comboboxes will be updated too. BackgroundStyle = MyBackgroundSettings.StyleMode; // Initializes the Background images. MyBackgroundSettings.Image = Image1 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "background1.jpg")); Image2 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "background2.jpg")); Image3 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "background3.jpg")); // Initializes the Images for the ViewCube buttons. VcResetImages = ViewCubeIcon.GetDefaultViewCubeIcon().FrontImage; VcImage1 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "Spongebob_Front.jpg")); VcImage2 = RenderContextUtility.ConvertImage(new Bitmap(Pictures + "Noel_Front.jpg")); // Initializes the EntitiList collection for the the data binding. _entityList = new MyEntityList(); }
public MediaPlayerHandle(CoreDispatcher dispatcher) { BackgroundSettings.RemoveForegroundId(); _dispatcher = dispatcher; _notifier = new BackgroundNotifier(_id); _subscriptionHandle = new BackgroundSubscriptionHandle(OnMessageReceivedFromBackground); _notificationQueue = new ValueSetWorkerQueue(HandleNotification); BackgroundSettings.SetForegroundId(_id); }
public void Suspend() { Debug.WriteLine("MediaPlayerHandle.Suspend()"); try { BackgroundSettings.RemoveForegroundId(_id); if (_subscriptionHandle.IsSubscribed) { _notifier.Notify(BackgroundNotificationType.Suspend); } Close(); _subscriptionHandle.Unsubscribe(); } catch (Exception ex) { Debug.WriteLine("MediaPlayerHandle.Suspend() failed: " + ex.ExtendedMessage()); } }
public void Fail() { Debug.WriteLine("MediaPlayerHandle.Fail()"); try { BackgroundSettings.RemoveForegroundId(_id); var backgroundId = BackgroundSettings.BackgroundId; if (backgroundId.HasValue) { _notifier.Notify(BackgroundNotificationType.Fail); } Close(); _subscriptionHandle.Unsubscribe(); } catch (Exception ex) { Debug.WriteLine("MediaPlayerHandle.Fail() failed: " + ex.ExtendedMessage()); } }
public async Task ResumeAsync() { Debug.WriteLine("MediaPlayerHandle.ResumeAsync()"); Debug.Assert(_dispatcher.HasThreadAccess, "ResumeAsync requires the dispatcher thread"); try { BackgroundSettings.SetForegroundId(_id); Close(); await OpenAsync().ConfigureAwait(false); if (_subscriptionHandle.IsSubscribed) { _notifier.Notify(BackgroundNotificationType.Resume); } } catch (Exception ex) { Debug.WriteLine("MediaPlayerHandle.ResumeAsync() failed: " + ex.ExtendedMessage()); } }
public ViewportLayout InitViewport() { var displayModeSettingsRendered1 = new DisplayModeSettingsRendered(true, edgeColorMethodType.EntityColor, Color.Black, 1F, 2F, silhouettesDrawingType.LastFrame, false, shadowType.Realistic, null, false, true, 0.3F, realisticShadowQualityType.High); var backgroundSettings1 = new BackgroundSettings(backgroundStyleType.LinearGradient, Color.WhiteSmoke, Color.White, Color.FromArgb(102, 163, 210), 0.75D, null); var camera1 = new Camera(new Point3D(0D, 0D, 0D), 100D, new Quaternion(0.12940952255126034D, 0.22414386804201339D, 0.4829629131445341D, 0.83651630373780794D), projectionType.Perspective, 50D, 8D); var toolBarButton1 = new ToolBarButton(null, "Zoom Window", "Zoom Window", ToolBarButtonStyle.ToggleButton, true); var toolBarButton2 = new ToolBarButton(null, "Zoom", "Zoom", ToolBarButtonStyle.ToggleButton, true); var toolBarButton3 = new ToolBarButton(null, "Pan", "Pan", ToolBarButtonStyle.ToggleButton, true); var toolBarButton4 = new ToolBarButton(null, "Rotate", "Rotate", ToolBarButtonStyle.ToggleButton, true); var toolBarButton5 = new ToolBarButton(null, "Zoom Fit", "Zoom Fit", ToolBarButtonStyle.PushButton, true); var toolBar1 = new devDept.Eyeshot.ToolBar(toolBarPositionType.HorizontalTopRight, 32, 3, 4, Color.FromArgb(255, 146, 0), true, new[] { toolBarButton1, toolBarButton2, toolBarButton3, toolBarButton4, toolBarButton5 }); var legend1 = new Legend(0D, 100D, "Title", "Subtitle", new Point(24, 24), new Size(10, 30), true, false, false, "{0:0.##}", System.Drawing.Color.Transparent, System.Drawing.Color.Black, System.Drawing.Color.Black, new System.Drawing.Font("Tahoma", 10F, FontStyle.Bold), new Font("Tahoma", 8.25F), new[] { Color.FromArgb(0, 0, 255), Color.FromArgb(0, 63, 255), Color.FromArgb(0, 127, 255), Color.FromArgb(0, 191, 255), Color.FromArgb(0, 255, 255), Color.FromArgb(0, 255, 191), Color.FromArgb(0, 255, 127), Color.FromArgb(0, 255, 63), Color.FromArgb(0, 255, 0), Color.FromArgb(63, 255, 0), Color.FromArgb(127, 255, 0), Color.FromArgb(191, 255, 0), Color.FromArgb(255, 255, 0), Color.FromArgb(255, 191, 0), Color.FromArgb(255, 127, 0), Color.FromArgb(255, 63, 0), Color.FromArgb(255, 0, 0) }); var originSymbol1 = new OriginSymbol(2, originSymbolStyleType.CoordinateSystem, new Font("Tahoma", 8.25F), Color.Black, Color.Red, Color.Green, Color.Blue, "Origin", "X", "Y", "Z", true); var rotateSettings1 = new RotateSettings(new MouseButton(MouseButtons.Middle, ModifierKeys.None), 10D, true, 1D, rotationStyleType.Trackball, rotationCenterType.CursorLocation, new devDept.Geometry.Point3D(0D, 0D, 0D)); var zoomSettings1 = new ZoomSettings(new MouseButton(MouseButtons.Middle, ModifierKeys.Shift), 25, true, zoomStyleType.AtCursorLocation, false, 1D, Color.DeepSkyBlue, perspectiveFitType.Accurate); var viewport1 = new Viewport(new Point(0, 0), new Size(100, 10000), backgroundSettings1, camera1, toolBar1, new[] { legend1 }, displayType.Rendered, true, false, false, CreateGrid(10), originSymbol1, false, rotateSettings1, zoomSettings1, new PanSettings(new MouseButton(MouseButtons.Middle, ModifierKeys.Ctrl), 25, true)); _viewportLayout = new SingleViewportLayout(); _viewportLayout.Dock = DockStyle.Fill; _viewportLayout.Cursor = Cursors.Arrow; _viewportLayout.Name = "SingleViewPort"; _viewportLayout.Rendered = displayModeSettingsRendered1; _viewportLayout.Size = new Size(431, 405); _viewportLayout.TabIndex = 0; _viewportLayout.Viewports.Add(viewport1); return _viewportLayout; }
public ViewportLayout InitViewport() { var displayModeSettingsRendered1 = new DisplayModeSettingsRendered(true, edgeColorMethodType.EntityColor, Color.Black, 1F, 2F, silhouettesDrawingType.LastFrame, false, shadowType.Realistic, null, false, true, 0.3F, realisticShadowQualityType.High); var backgroundSettings1 = new BackgroundSettings(backgroundStyleType.LinearGradient, Color.WhiteSmoke, Color.White, Color.FromArgb(102, 163, 210), 0.75D, null); var camera1 = new Camera(new Point3D(0D, 0D, 0D), 100D, new Quaternion(0.12940952255126034D, 0.22414386804201339D, 0.4829629131445341D, 0.83651630373780794D), projectionType.Perspective, 50D, 8D); var toolBarButton1 = new ToolBarButton(null, "Zoom Window", "Zoom Window", ToolBarButtonStyle.ToggleButton, true); var toolBarButton2 = new ToolBarButton(null, "Zoom", "Zoom", ToolBarButtonStyle.ToggleButton, true); var toolBarButton3 = new ToolBarButton(null, "Pan", "Pan", ToolBarButtonStyle.ToggleButton, true); var toolBarButton4 = new ToolBarButton(null, "Rotate", "Rotate", ToolBarButtonStyle.ToggleButton, true); var toolBarButton5 = new ToolBarButton(null, "Zoom Fit", "Zoom Fit", ToolBarButtonStyle.PushButton, true); var toolBar1 = new devDept.Eyeshot.ToolBar(toolBarPositionType.HorizontalTopRight, 32, 3, 4, Color.FromArgb(255, 146, 0), true, new[] { toolBarButton1, toolBarButton2, toolBarButton3, toolBarButton4, toolBarButton5 }); var legend1 = new Legend(0D, 100D, "Title", "Subtitle", new Point(24, 24), new Size(10, 30), true, false, false, "{0:0.##}", System.Drawing.Color.Transparent, System.Drawing.Color.Black, System.Drawing.Color.Black, new System.Drawing.Font("Tahoma", 10F, FontStyle.Bold), new Font("Tahoma", 8.25F), new[] { Color.FromArgb(0, 0, 255), Color.FromArgb(0, 63, 255), Color.FromArgb(0, 127, 255), Color.FromArgb(0, 191, 255), Color.FromArgb(0, 255, 255), Color.FromArgb(0, 255, 191), Color.FromArgb(0, 255, 127), Color.FromArgb(0, 255, 63), Color.FromArgb(0, 255, 0), Color.FromArgb(63, 255, 0), Color.FromArgb(127, 255, 0), Color.FromArgb(191, 255, 0), Color.FromArgb(255, 255, 0), Color.FromArgb(255, 191, 0), Color.FromArgb(255, 127, 0), Color.FromArgb(255, 63, 0), Color.FromArgb(255, 0, 0) }); var originSymbol1 = new OriginSymbol(2, originSymbolStyleType.CoordinateSystem, new Font("Tahoma", 8.25F), Color.Black, Color.Red, Color.Green, Color.Blue, "Origin", "X", "Y", "Z", true); var rotateSettings1 = new RotateSettings(new MouseButton(MouseButtons.Middle, ModifierKeys.None), 10D, true, 1D, rotationStyleType.Trackball, rotationCenterType.CursorLocation, new devDept.Geometry.Point3D(0D, 0D, 0D)); var zoomSettings1 = new ZoomSettings(new MouseButton(MouseButtons.Middle, ModifierKeys.Shift), 25, true, zoomStyleType.AtCursorLocation, false, 1D, Color.DeepSkyBlue, perspectiveFitType.Accurate); var viewport1 = new Viewport(new Point(0, 0), new Size(100, 10000), backgroundSettings1, camera1, toolBar1, new[] { legend1 }, displayType.Rendered, true, false, false, CreateGrid(10), originSymbol1, false, rotateSettings1, zoomSettings1, new PanSettings(new MouseButton(MouseButtons.Middle, ModifierKeys.Ctrl), 25, true)); _viewportLayout = new SingleViewportLayout(); _viewportLayout.Dock = DockStyle.Fill; _viewportLayout.Cursor = Cursors.Arrow; _viewportLayout.Name = "SingleViewPort"; _viewportLayout.Rendered = displayModeSettingsRendered1; _viewportLayout.Size = new Size(431, 405); _viewportLayout.TabIndex = 0; _viewportLayout.Viewports.Add(viewport1); return(_viewportLayout); }
public TestService(ILogger <TestService> logger, IOptions <BackgroundSettings> backgroundSettings) { _logger = logger; _backgroundSettings = backgroundSettings.Value; }