Responsible for loading and playing slideshows, though delegating to a viewer for the actual image display. All calls to the viewer are on the main/UI thread in order to minimize threading issues in the various UI implementations.
Наследование: INotifyPropertyChanged
Пример #1
0
		static public SlideshowDriver Create(SlideshowModel model, ISlideshowViewer viewer, IPlatformService platformService)
		{
			var driver = new SlideshowDriver(model, viewer, platformService);
			driver.BeginEnumerate();
			return driver;
		}
		public override void AwakeFromNib()
		{
			base.AwakeFromNib();
			driver = SlideshowDriver.Create(Model, this, this);

			Window.BackgroundColor = NSColor.Black;
			var contentView = Window.ContentView;

			contentView.WantsLayer = true;
			imageView = CreateImageView();
			contentView.AddSubview(imageView, NSWindowOrderingMode.Below, contentView.Subviews[0]);

			CreateTransitions();
			Window.Delegate = new SlideshowWindowDelegate(this);
			Window.AcceptsMouseMovedEvents = true;

			var screenSize = Window.Screen.Frame;
			var width = (float) (screenSize.Width * 0.75);
			var height = (float) (screenSize.Height * 0.75);
			var newFrame = new RectangleF 
			{
				Width = width,
				Height = height,
				X = (float) (screenSize.Left + ((screenSize.Width - width) / 2)),
				Y = (float) (screenSize.Top + ((screenSize.Height - height) / 2))
			};
			Window.SetFrame(newFrame, false, false);

			_hideControlsTimer.Elapsed += (s, e) =>
			{
				var diff = (NSDate.Now.SecondsSinceReferenceDate - _lastMouseMoveTime) * 1000;
				if (diff > _hideControlsTimer.Interval)
				{
					InvokeOnUiThread( () => HideControls() );
				}
			};

			infoText.Cell.Title = "";
			_lastMouseMoveTime = NSDate.Now.SecondsSinceReferenceDate;
			UpdateUiState();
			ShowControls();
		}