public override object ProvideValue(IServiceProvider serviceProvider) { DebugHelper.AssertUIThread(); object value = null; Binding binding = new Binding("Value"); BinaryMetadataConverter instanceConverter = new BinaryMetadataConverter(this.structType, this.path, this.converter, this.converterParameter); MultiBinding multiBinding = new MultiBinding() { Converter = instanceConverter, Mode = this.BindingMode, }; multiBinding.Bindings.Add(binding); value = multiBinding.ProvideValue(serviceProvider); return(value); }
private bool DoSave() { DebugHelper.AssertUIThread(); bool handled = false; TargetOpenSaveFileData data = this.DataContext as TargetOpenSaveFileData; if (data != null) { if (data.IsValidFileName) { handled = true; this.DialogResult = true; Close(); } } return(handled); }
private static void LoadDataTemplates(DataTemplate dataTemplate, IDictionary <FileMetadataDataTemplateKey, DataTemplate> fileDataTemplates, IDictionary <StreamMetadataDataTemplateKey, DataTemplate> streamDataTemplates, Type valueType) { DebugHelper.AssertUIThread(); Debug.Assert(fileDataTemplates != null); Debug.Assert(streamDataTemplates != null); Debug.Assert(valueType != null); if (dataTemplate != null) { { FileMetadataDataTemplateKey key = new FileMetadataDataTemplateKey(valueType); fileDataTemplates.Add(key, dataTemplate); } { StreamMetadataDataTemplateKey key = new StreamMetadataDataTemplateKey(valueType); streamDataTemplates.Add(key, dataTemplate); } } }
protected override void Dispose(bool disposing) { if (disposing) { DebugHelper.AssertUIThread(); if (this.arcBallCamera != null) { this.arcBallCamera.Dispose(); this.arcBallCamera = null; } if (this.mouseNavigator != null) { this.mouseNavigator.Dispose(); this.mouseNavigator = null; } } base.Dispose(disposing); }
// should be locked private void Init() { DebugHelper.AssertUIThread(); if (this.localComputer == null) { this.localComputer = new MostRecentlyUsedState(); this.sessionStateService = ToolsUIApplication.Instance.RootServiceProvider.GetService(typeof(ISessionStateService)) as ISessionStateService; if (this.sessionStateService != null) { this.sessionStateService.DeclareSessionStateVariable("MostRecentlyUsed-LocalComputer", this.localComputer); string alias = Environment.MachineName; TargetMostRecentlyUsedState mruState = new TargetMostRecentlyUsedState(alias); this.targets[alias] = mruState; this.sessionStateService.DeclareSessionStateVariable("MostRecentlyUsed-Target-" + mruState.Id, mruState); } this.openReadOnlyFileTabControls.Add(new OpenTabItemData() { SubMode = "ComputerReadOnly", Header = Strings.SingleBoxReadOnlyDevelopmentComputer_Label, Shortcut = Strings.SingleBoxReadOnlyDevelopmentComputer_Shortcut, ContentTemplate = Application.Current.Resources["OpenSingleBoxReadOnlyTemplate"] as DataTemplate, IconTemplate = Application.Current.Resources["LocalComputerIconTemplate"] as DataTemplate, Content = new Tuple <string, object>(null, this.localComputer.Items), }); this.openWritableFileTabControls.Add(new OpenTabItemData() { SubMode = "ComputerEdit", Header = Strings.SingleBoxWritableDevelopmentComputer_Label, Shortcut = Strings.SingleBoxWritableDevelopmentComputer_Shortcut, ContentTemplate = Application.Current.Resources["OpenSingleBoxWritableTemplate"] as DataTemplate, IconTemplate = Application.Current.Resources["LocalComputerIconTemplate"] as DataTemplate, Content = new Tuple <string, object>(null, this.localComputer.Items), }); } }
public void DecouplePausePoint(TimelinePausePoint pausePointToDecouple) { DebugHelper.AssertUIThread(); Debug.Assert(this.owner != null); if (pausePointToDecouple == null) { throw new ArgumentNullException("pausePointToDecouple"); } if (this.pausePoint != null) { if (this.pausePoint != pausePointToDecouple) { throw new InvalidOperationException("pause point not matching"); } this.pausePoint = null; this.RaisePropertyChanged("CoupledPausePoint"); } }
protected override void OnDataChanged(TimeSpan oldTime, bool dirty, bool promote, bool save) { DebugHelper.AssertUIThread(); Debug.Assert(this.owner != null); if (this.marker != null) { this.marker.RelativeTime = this.RelativeTime; var file = this.Source as KStudioWritableEventFile; if (file != null) { file.FlushIndex(); } } this.owner.OnTimePointDataChanged(this, oldTime, dirty, promote, save); if (this.pausePoint != null) { this.pausePoint.RelativeTime = this.RelativeTime; } }
public bool OtherIsSupplyingTexture() { DebugHelper.AssertUIThread(); if (this.checkReentrant > 0) { return(false); } bool value = false; this.checkReentrant++; if (this.surface) { value = true; } this.checkReentrant--; return(value); }
public void SetupForPlayback(ReadOnlyObservableCollection <KStudioEventStream> clientEventStreams) { DebugHelper.AssertUIThread(); if ((this.livePlaybackStreams == null) && (clientEventStreams != null)) { ListCollectionView targetPlaybackableStreams = new ListCollectionView(clientEventStreams); targetPlaybackableStreams.Filter = (object item) => { KStudioEventStream s = item as KStudioEventStream; Debug.Assert(s != null); return(s.IsPlaybackable && s.IsFromService && (s.DataTypeId == this.stream.DataTypeId)); }; targetPlaybackableStreams.SortDescriptions.Clear(); targetPlaybackableStreams.SortDescriptions.Add(new SortDescription("UserState.ShortNameUppercase", ListSortDirection.Ascending)); targetPlaybackableStreams.Refresh(); this.livePlaybackStreams = targetPlaybackableStreams; this.RaisePropertyChanged("LivePlaybackStreams"); } }
protected override void Dispose(bool disposing) { if (disposing) { DebugHelper.AssertUIThread(); if (this.image != null) { this.image.Source = null; } if (this.renderTarget != null) { this.renderTarget.Dispose(); this.renderTarget = null; this.renderTargetWidth = 0; this.renderTargetHeight = 0; } } base.Dispose(disposing); }
private void FixRenderTargetSize(uint w, uint h) { DebugHelper.AssertUIThread(); if ((this.renderTargetWidth != w) || (this.renderTargetHeight != h)) { if (this.image != null) { this.image.Source = null; } if (this.renderTarget != null) { this.renderTarget.Dispose(); this.renderTarget = null; this.renderTargetWidth = 0; this.renderTargetHeight = 0; } if ((this.PluginService != null) && (this.imageHost != null) && (w > 0) && (h > 0)) { viz.Context context = this.PluginService.GetContext(this.EventType); viz.D3DImageContext imageContext = this.PluginService.GetImageContext(this.EventType); if ((context != null) && (imageContext != null)) { #if LOG_INFO string str = String.Format("{0:10} {1}: {2}", this.GetHashCode(), "RNDRTARG ", this.stopwatch.ElapsedMilliseconds); Trace.WriteLine(str); #endif // LOG_INFO this.renderTarget = new viz.D3DImageTexture(context, imageContext, w, h); this.renderTargetWidth = w; this.renderTargetHeight = h; } } this.OnRenderTargetChanged(this.renderTarget); } }
public override void OnTimePointDataChanged(TimelinePausePoint point, TimeSpan oldTime, bool doDirty, bool doPromote, bool doSave) { DebugHelper.AssertUIThread(); Debug.Assert(this.Points != null); if ((this.ignore == 0) && (point != null)) { if (doDirty) { this.IsDirty = true; } if (doPromote) { if (this.Points.Count > 0) { if (this.Points.Last() != point) { // move it to the end of the list for UI purposes if (this.Points.Remove(point)) { this.Points.Add(point); } } } } this.UpdatePlaybackPausePoints(); if (doSave) { this.OnSave(); } this.HasEnabled = this.Points.Any((pp) => pp.IsEnabled); this.HasDisabled = this.Points.Any((pp) => !pp.IsEnabled); } }
private void AddCommand_Executed(object sender, ExecutedRoutedEventArgs e) { DebugHelper.AssertUIThread(); ObservableCollection <ValueHolder> list = this.ItemsSource as ObservableCollection <ValueHolder>; if (list != null) { ValueHolder newItem = new ValueHolder(this.DefaultValue); int index = this.List.SelectedIndex; if (index < 0) { list.Add(newItem); this.List.SelectedIndex = list.Count - 1; } else { list.Insert(index, newItem); this.List.SelectedIndex = index; } } }
protected override void OnMouseUp(MouseButtonEventArgs e) { DebugHelper.AssertUIThread(); if (e == null) { throw new ArgumentNullException("e"); } if (e.ChangedButton == MouseButton.Left) { if (this.mouseNavigator != null) { e.Handled = true; this.mouseNavigator.OnMouseEnd(); UpdateCursor(); } } base.OnMouseUp(e); }
public void RemoveAll() { DebugHelper.AssertUIThread(); Debug.Assert(this.Points != null); if (this.Points.Count > 0) { foreach (TimelinePausePoint pausePoint in this.Points) { pausePoint.DecoupleMarker(); } this.Points.Clear(); this.UpdatePlaybackPausePoints(); this.IsDirty = true; this.OnSave(); this.HasEnabled = false; this.HasDisabled = false; } }
private void UpdatePlaybackPausePoints() { DebugHelper.AssertUIThread(); Debug.Assert(this.Points != null); List <TimeSpan> pausePoints = new List <TimeSpan>(); foreach (TimelinePausePoint pausePoint in this.Points) { if (pausePoint.IsEnabled) { pausePoints.Add(pausePoint.RelativeTime); } } KStudioPlayback playback = this.Playback; if (playback != null) { playback.SetPausePointsByRelativeTime(pausePoints); } }
public TimelineMarker AddAt(TimeSpan relativeTime, string markerName) { DebugHelper.AssertUIThread(); Debug.Assert(this.Points != null); TimelineMarker markerProxy = null; KStudioWritableEventFile file = this.Source as KStudioWritableEventFile; if (file != null) { KStudioMarker marker = file.Markers.Add(markerName, relativeTime); if (marker != null) { markerProxy = new TimelineMarker(this, relativeTime, marker); this.Points.Add(markerProxy); } file.FlushIndex(); } return(markerProxy); }
public override void OnTimePointDataChanged(TimelineMarker point, TimeSpan oldTime, bool doDirty, bool doPromote, bool doSave) { DebugHelper.AssertUIThread(); Debug.Assert(this.Points != null); if (point != null) { if (doPromote) { if (this.Points.Count > 0) { if (this.Points.Last() != point) { // move it to the end of the list for UI purposes if (this.Points.Remove(point)) { this.Points.Add(point); } } } } } }
protected override ToolsUIWindow CreateToolsUIWindow() { DebugHelper.AssertUIThread(); string[] args = null; if (this.firstWindow) { args = Environment.GetCommandLineArgs(); this.firstWindow = false; } MainWindow mainWindow = new MainWindow(args); if (args != null) { if (this.splash != null) { IPluginService pluginService = this.RootServiceProvider.GetService(typeof(IPluginService)) as IPluginService; if (pluginService != null) { pluginService.Initialize(); } mainWindow.Loaded += (s, ea) => { if (this.splash != null) { this.splash.Close(TimeSpan.Zero); this.splash = null; } }; } } return(mainWindow); }
public TimelinePausePoint AddAt(TimeSpan relativeTime) { DebugHelper.AssertUIThread(); Debug.Assert(this.Points != null); Debug.Assert(this.Source != null); TimelinePausePoint pausePoint = null; bool updatePlayback = false; if ((relativeTime >= TimeSpan.Zero) && (relativeTime <= this.Source.Duration)) { if (this.ignore == 0) { if (this.RemoveInternal(relativeTime)) { updatePlayback = true; } } pausePoint = new TimelinePausePoint(this, relativeTime); this.Points.Add(pausePoint); if (updatePlayback) { this.UpdatePlaybackPausePoints(); } this.HasEnabled = true; this.IsDirty = true; this.OnSave(); } return(pausePoint); }
void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e) { DebugHelper.AssertUIThread(); #if LOG_INFO string str = String.Format("{0:10} {1}: {2}", this.GetHashCode(), "DSP-CHGD ", this.stopwatch.ElapsedMilliseconds); Trace.WriteLine(str); #endif // LOG_INFO this.displaySettingsChanging = false; this.FixImageSize(); viz.Context context = null; if (this.PluginService != null) { context = this.PluginService.GetContext(this.EventType); } if (context != null) { this.OnNuiVizInitialize(context); } }
private void Playback_StateChanged(object sender, EventArgs e) { DebugHelper.AssertUIThread(); Debug.Assert(this.Points != null); KStudioPlayback playback = this.Playback; if ((playback != null) && (playback == sender)) { KStudioPlaybackState state = playback.State; bool enabled = (state == KStudioPlaybackState.Idle) || (state == KStudioPlaybackState.Paused) || (state == KStudioPlaybackState.Stopped); this.ignore++; foreach (TimelineInOutPoint point in this.Points) { point.IsEnabled = enabled; } this.ignore--; } RaisePropertyChanged("IsEnabled"); }
private void PausePointAdd_Executed(object sender, ExecutedRoutedEventArgs e) { DebugHelper.AssertUIThread(); if ((e != null) && (this.PausePointsSource != null)) { e.Handled = true; TimelineMarker marker = e.Parameter as TimelineMarker; if (marker == null) { if (this.newPointTime.HasValue) { this.PausePointsSource.AddAt(this.newPointTime.Value); } } else { this.PausePointsSource.AddAt(marker.RelativeTime); } } this.newPointTime = null; }
private void ListView_ItemsChanged(ListView listView, ItemsChangedEventArgs e) { DebugHelper.AssertUIThread(); if ((listView != null) && (e != null)) { switch (e.Action) { case NotifyCollectionChangedAction.Add: if (MetadataViewContent.lastFocused == this) { int newIndex = listView.Items.Count - 1; listView.SelectedIndex = newIndex; listView.ScrollIntoView(listView.Items[newIndex]); this.setNextMetadatFocus = listView; } break; default: this.setNextMetadatFocus = null; break; } } }
protected ImageVisualizationControl(IServiceProvider serviceProvider, EventType eventType, VisualizationViewSettings viewSettings, Func <IPlugin, bool> filterFunc, IAvailableStreams availableStreamsGetter) : base(serviceProvider, viewSettings, filterFunc, eventType, availableStreamsGetter) { DebugHelper.AssertUIThread(); }
private void UpdateTimer_Tick(object sender, EventArgs e) { DebugHelper.AssertUIThread(); this.InvalidateVisual(); }
private bool DoRender() { DebugHelper.AssertUIThread(); bool result = false; { if ((this.image != null) && (this.Visibility == System.Windows.Visibility.Visible)) { result = true; viz.Context context = null; if (this.PluginService != null) { context = this.PluginService.GetContext(this.EventType); } if (this.image != null) { if (context != null) { if (!context.BeginRender()) { context = null; } } } if (context != null) { this.OnBeginRender(context); viz.Texture texture = null; foreach (PluginViewState pluginViewState in this.PluginViewStates) { if (pluginViewState.IsEnabled) { IImageVisualPlugin visualPlugin = pluginViewState.Plugin as IImageVisualPlugin; if (visualPlugin != null) { texture = visualPlugin.GetTexture(this.EventType, pluginViewState.PluginViewSettings); if (texture != null) { break; } } } } float scaledWidth = 0; float scaledHeight = 0; this.OnGetLayout(context, texture, ref scaledWidth, ref scaledHeight); if (this.imageHost is Canvas) { uint w = (uint)scaledWidth; uint h = (uint)scaledHeight; if (this.image != null) { this.image.Width = w; this.image.Height = h; } this.FixRenderTargetSize(w, h); } if (this.renderTarget != null) { if (this.renderTarget.BeginRender(this.ClearColor, 1)) { foreach (PluginViewState pluginViewState in this.PluginViewStates) { if (pluginViewState.IsEnabled) { IImageVisualPlugin visualPlugin = pluginViewState.Plugin as IImageVisualPlugin; if (visualPlugin != null) { I2DVisualPlugin visualPlugin2d = visualPlugin as I2DVisualPlugin; if (visualPlugin2d != null) { visualPlugin2d.Render2D(this.EventType, pluginViewState.PluginViewSettings, context, texture, 0, 0, scaledWidth, scaledHeight); } I3DVisualPlugin visualPlugin3d = visualPlugin as I3DVisualPlugin; if (visualPlugin3d != null) { visualPlugin3d.Render3D(this.EventType, pluginViewState.PluginViewSettings, context, texture); } } } } this.OnEndRender(context, texture, scaledWidth, scaledHeight); this.renderTarget.EndRender(); } } context.EndRender(); } } } return(result); }
private void ImageHost_Loaded(object sender, RoutedEventArgs e) { DebugHelper.AssertUIThread(); this.FixImageSize(); }
protected override void OnRender(DrawingContext drawingContext) { DebugHelper.AssertUIThread(); this.needsRender = true; }
protected void FixLayout() { DebugHelper.AssertUIThread(); this.OnFixLayout(); }