public TargetConnectionViewContent(IKStudioService kstudioService) { DebugHelper.AssertUIThread(); this.KStudioService = kstudioService; this.InitializeComponent(); }
public TargetRecordableStreamsViewContent(IKStudioService kstudioService) { DebugHelper.AssertUIThread(); this.KStudioService = kstudioService; this.InitializeComponent(); }
public PlaybackableStreamsViewContent(IKStudioService kstudioService) { DebugHelper.AssertUIThread(); this.KStudioService = kstudioService; this.InitializeComponent(); }
public EventStreamState(KStudioEventStream stream, IKStudioService kstudioService, bool obscureStream) { DebugHelper.AssertUIThread(); if (stream == null) { throw new ArgumentNullException("stream"); } if (kstudioService == null) { throw new ArgumentNullException("kstudioService"); } this.stream = stream; this.kstudioService = kstudioService; this.obscureStream = obscureStream; this.ShortName = stream.Name; if (String.IsNullOrWhiteSpace(this.ShortName)) { this.ShortName = stream.DataTypeName; } if (String.IsNullOrWhiteSpace(this.ShortName)) { this.ShortName = stream.DataTypeId.ToString() + ":" + stream.SemanticId; } this.ShortNameUppercase = this.ShortName.ToUpperInvariant(); StringBuilder sb = new StringBuilder(); if (!String.IsNullOrWhiteSpace(stream.DataTypeName)) { sb.Append(stream.DataTypeName); sb.AppendLine(); } if (!String.IsNullOrWhiteSpace(stream.Name)) { sb.Append(stream.Name); sb.AppendLine(); } sb.Append(stream.DataTypeId); sb.Append(":"); sb.Append(stream.SemanticId); this.LongName = sb.ToString(); }
public MainWindow(string[] args) { InitializeWindow(); InitializeComponent(); IServiceProvider serviceProvider = ToolsUIApplication.Instance.RootServiceProvider; if (serviceProvider != null) { this.loggingService = serviceProvider.GetService(typeof(ILoggingService)) as ILoggingService; this.notificationService = serviceProvider.GetService(typeof(IUserNotificationService)) as IUserNotificationService; this.kstudioService = serviceProvider.GetService(typeof(IKStudioService)) as IKStudioService; this.metadataViewService = serviceProvider.GetService(typeof(IMetadataViewService)) as IMetadataViewService; this.pluginService = serviceProvider.GetService(typeof(IPluginService)) as IPluginService; } if (this.kstudioService != null) { MultiBinding titleBinding = new MultiBinding { Converter = new TitleConverter { NoFileString = Strings.WindowTitle_NoFile, ReadOnlyFileFormat = Strings.WindowTitle_ReadOnlyFileFormat, WritableFileFormat = Strings.WindowTitle_WritableFileFormat, }, FallbackValue = ToolsUIApplication.Instance.AppTitle, }; titleBinding.Bindings.Add(new Binding { Source = this.kstudioService, Path = new PropertyPath("RecordingFilePath"), }); titleBinding.Bindings.Add(new Binding { Source = this.kstudioService, Path = new PropertyPath("PlaybackFilePath"), }); titleBinding.Bindings.Add(new Binding { Source = this.kstudioService, Path = new PropertyPath("IsPlaybackFileReadOnly"), }); this.SetBinding(Window.TitleProperty, titleBinding); this.kstudioService.PlaybackOpened += (s, e) => { DebugHelper.AssertUIThread(); if (!this.suppressAutoSwitch) { this.SwitchToView("PlaybackableStreamsView"); } }; this.kstudioService.Busy += (s, e) => { DebugHelper.AssertUIThread(); if (e != null) { this.IsEnabled = !e.IsBusy; } }; } if ((args != null) && (this.kstudioService != null)) { if (args.Length > 1) { bool connect = false; bool readOnly = false; string fileName = null; for (int i = 1; i < args.Length; ++i) { string arg = args[i]; if ((arg.Length > 1) && (arg[0] == '-')) { char ch = Char.ToUpperInvariant(arg[1]); switch (ch) { case 'R': readOnly = true; break; } } else { fileName = args[i]; } } string error = null; string targetAlias = null; IPAddress targetAddress = null; targetAlias = Environment.MachineName; targetAddress = IPAddress.Loopback; this.Loaded += (s, e) => { Dispatcher.BeginInvoke(new Action(() => { if (error == null) { if (connect) { if (targetAddress != null) { using (WaitCursor waitCursor = new WaitCursor(this)) { if (!this.kstudioService.ConnectToTarget(targetAddress, targetAlias)) { fileName = null; } } } } if (fileName != null) { error = String.Format(CultureInfo.CurrentCulture, Strings.Arg_Error_InvalidFileName, fileName); if (fileName.Length > 2) { using (WaitCursor waitCursor = new WaitCursor(this)) { this.OpenFile(fileName, readOnly); error = null; } } } } if (error != null) { if (this.notificationService != null) { this.notificationService.ShowMessageBox(error, MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK); } else if (this.loggingService != null) { this.loggingService.LogLine(error); } } CommandManager.InvalidateRequerySuggested(); } )); }; } } }