public SpeakersManager(Speaker originalSpeaker, WPFTranscription transcription, SpeakerCollection documentSpeakers, SpeakerCollection localSpeakers = null) { DataContext = this;//not good :) _originalSpeaker = originalSpeaker; _localSpeakers = localSpeakers; _documentSpeakers = documentSpeakers; _transcription = transcription; InitializeComponent(); SpeakerProvider = new SpeakerManagerViewModel(new SpeakerCollection(documentSpeakers.Concat(transcription.EnumerateParagraphs().Select(p => p.Speaker)).Where(s => s != Speaker.DefaultSpeaker).Distinct()), localSpeakers, transcription.Api, this); var ss = SpeakerProvider.GetContainerForSpeaker(originalSpeaker); if (ss != null) { ss.Marked = true; } SpeakersBox.SelectedValue = ss; SpeakersBox.ScrollIntoView(SpeakersBox.SelectedItem); if (_transcription.Api != null) { SpeakerProvider.ShowLocal = false; SpeakerProvider.ShowOnline = true; } //SpeakersBox.Items.SortDescriptions.Add( new SortDescription("",ListSortDirection.Ascending)); }
public SpeakerContainer(SpeakerCollection speakers, Speaker s) { _speaker = s; this.SpeakerColletion = speakers; _OriginalAttributes = s.Attributes.Select(a => new SpeakerAttribute(a)).ToList();; }
public SpeakerContainer(SpeakerCollection speakers, Speaker s) { _speaker = s; this.SpeakerColletion = speakers; _OriginalAttributes = s.Attributes.Select(a => new SpeakerAttribute(a)).ToList(); ; }
public static Speaker SynchronizedAdd(SpeakerCollection speakers, Speaker s) { var found = speakers.FirstOrDefault(sp => sp.DBID == s.DBID); if (found == null) { speakers.Add(s); } else { if (found.Synchronized < s.Synchronized) { speakers.Remove(found); speakers.Add(s); return(found); } } return(null); }
public static Speaker SynchronizedAdd(SpeakerCollection speakers, Speaker s) { var found = speakers.FirstOrDefault(sp=>sp.DBID == s.DBID); if (found == null) { speakers.Add(s); } else { if(found.Synchronized < s.Synchronized) { speakers.Remove(found); speakers.Add(s); return found; } } return null; }
public SpeakerManagerViewModel(SpeakerCollection documentSpeakers, SpeakerCollection localSpeakers, SpeakersApi api, SpeakersManager window) { _window = window; _api = api; if (_api != null) { _loadingTimer = new System.Timers.Timer(1000); _loadingTimer.AutoReset = false; _loadingTimer.Elapsed += _loadingTimer_Elapsed; } this._document = documentSpeakers; this._local = localSpeakers; _showOnline = Settings.Default.SpeakerManagerShowOnline; _showLocal = Settings.Default.SpeakerManagerShowLocal; _showDocument = Settings.Default.SpeakerManagerShowDocument; this.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { switch (e.PropertyName) { case "ShowLocal": Settings.Default.SpeakerManagerShowLocal = this.ShowLocal; break; case "ShowDocument": Settings.Default.SpeakerManagerShowLocal = this.ShowDocument; break; case "ShowOnline": Settings.Default.SpeakerManagerShowLocal = this.ShowOnline; break; } }; ReloadSpeakers(); }
public SpeakersManager(Speaker originalSpeaker, WPFTranscription transcription, SpeakerCollection documentSpeakers, SpeakerCollection localSpeakers = null) { DataContext = this;//not good :) _originalSpeaker = originalSpeaker; _localSpeakers = localSpeakers; _documentSpeakers = documentSpeakers; _transcription = transcription; InitializeComponent(); SpeakerProvider = new SpeakerManagerViewModel(documentSpeakers, localSpeakers, transcription.Api,this); var ss = SpeakerProvider.GetContainerForSpeaker(originalSpeaker); if (ss != null) ss.Marked = true; SpeakersBox.SelectedValue = ss; SpeakersBox.ScrollIntoView(SpeakersBox.SelectedItem); if (_transcription.Api != null) { SpeakerProvider.ShowLocal = false; SpeakerProvider.ShowOnline = true; } //SpeakersBox.Items.SortDescriptions.Add( new SortDescription("",ListSortDirection.Ascending)); }
private void ButtonLoadSpeakersDatabase_Click(object sender, RoutedEventArgs e) { var fileDialog = new Microsoft.Win32.SaveFileDialog(); fileDialog.OverwritePrompt = false; fileDialog.Title = Properties.Strings.FileDialogLoadSpeakersDatabaseTitle; fileDialog.Filter = string.Format(Properties.Strings.FileDialogLoadSpeakersDatabaseFilter, "*.xml", "*.xml"); FileInfo fi = new FileInfo(Settings.SpeakersDatabasePath); if (fi != null && fi.Directory.Exists) { fileDialog.InitialDirectory = fi.DirectoryName; } else { fileDialog.InitialDirectory = FilePaths.DefaultDirectory; } fileDialog.FilterIndex = 1; if (fileDialog.ShowDialog() == true) { if (File.Exists(fileDialog.FileName)) { _speakersDatabase.Clear(); SpeakerCollection.Deserialize(fileDialog.FileName, _speakersDatabase); } else { _speakersDatabase.FileName = fileDialog.FileName; _speakersDatabase.Serialize(); } tbSpeakerDBPath.Text = Settings.SpeakersDatabasePath = fileDialog.FileName; } }
/// <param name='searchTerm'> /// Required. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> public async Task <HttpOperationResponse <IList <Speaker> > > GetBySearchTermWithOperationResponseAsync(string searchTerm, CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Validate if (searchTerm == null) { throw new ArgumentNullException("searchTerm"); } // Tracing bool shouldTrace = ServiceClientTracing.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("searchTerm", searchTerm); ServiceClientTracing.Enter(invocationId, this, "GetBySearchTermAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/api/SpeakersByName/"; url = url + Uri.EscapeDataString(searchTerm); string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Credentials if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (shouldTrace) { ServiceClientTracing.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); HttpResponseMessage httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { ServiceClientTracing.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); if (statusCode != HttpStatusCode.OK) { HttpOperationException <object> ex = new HttpOperationException <object>(); ex.Request = httpRequest; ex.Response = httpResponse; ex.Body = null; if (shouldTrace) { ServiceClientTracing.Error(invocationId, ex); } throw ex; } // Create Result HttpOperationResponse <IList <Speaker> > result = new HttpOperationResponse <IList <Speaker> >(); result.Request = httpRequest; result.Response = httpResponse; // Deserialize Response if (statusCode == HttpStatusCode.OK) { IList <Speaker> resultModel = new List <Speaker>(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null) { resultModel = SpeakerCollection.DeserializeJson(responseDoc); } result.Body = resultModel; } if (shouldTrace) { ServiceClientTracing.Exit(invocationId, result); } return(result); }
public SpeakerContainer(SpeakerCollection speakers, Speaker s) { _speaker = s; this.SpeakerColletion = speakers; }
public WinSetup(SpeakerCollection speakerDB) { _speakersDatabase = speakerDB; InitializeComponent(); //audio cbOutputAudioDevices.Items.Clear(); string[] devices = DXWavePlayer.DeviceNamesOUT; if (devices != null) { foreach (string s in devices) { cbOutputAudioDevices.Items.Add(s); } } if (Settings.OutputDeviceIndex < cbOutputAudioDevices.Items.Count) { cbOutputAudioDevices.SelectedIndex = Settings.OutputDeviceIndex; } string path = Settings.SpeakersDatabasePath; try { if (!path.Contains(":")) //absolute { path = Settings.SpeakersDatabasePath; } path = new FileInfo(path).FullName; } finally { tbSpeakerDBPath.Text = path; } tbTextSize.Text = Settings.SetupTextFontSize.ToString(); chbShowSpeakerImage.IsChecked = Settings.ShowSpeakerImage; slSpeakerImageSize.Value = Settings.MaxSpeakerImageWidth; //playback decimal val = (decimal)Settings.SlowedPlaybackSpeed; if (val >= UpDownSpeed.Minimum.Value && val <= UpDownSpeed.Maximum.Value) { UpDownSpeed.Value = val; } val = (decimal)(Settings.WaveformSmallJump.TotalMilliseconds); if (val >= UpDownJump.Minimum.Value && val <= UpDownJump.Maximum.Value) { UpDownJump.Value = val; } if (AvailableCultures != null && AvailableCultures.Length <= 1) { int index = AvailableCultures.Select((c, i) => new { c, i }).FirstOrDefault(p => p.c.DisplayName == LocalizeDictionary.Instance.Culture.DisplayName).i; LocalizationSelection.SelectedItem = preselectionCulture = AvailableCultures[index]; } else { LocalizationBox.Visibility = System.Windows.Visibility.Collapsed; } }
public WinSetup(SpeakerCollection speakerDB) { _speakersDatabase = speakerDB; InitializeComponent(); //audio cbOutputAudioDevices.Items.Clear(); string[] devices = DXWavePlayer.DeviceNamesOUT; if (devices != null) { foreach (string s in devices) { cbOutputAudioDevices.Items.Add(s); } } if (Settings.OutputDeviceIndex < cbOutputAudioDevices.Items.Count) cbOutputAudioDevices.SelectedIndex = Settings.OutputDeviceIndex; string path = Settings.SpeakersDatabasePath; try { if (!path.Contains(":")) //absolute { path = Settings.SpeakersDatabasePath; } path = new FileInfo(path).FullName; } finally { tbSpeakerDBPath.Text = path; } tbTextSize.Text = Settings.SetupTextFontSize.ToString(); chbShowSpeakerImage.IsChecked = Settings.ShowSpeakerImage; slSpeakerImageSize.Value = Settings.MaxSpeakerImageWidth; //playback decimal val = (decimal)Settings.SlowedPlaybackSpeed; if (val >= UpDownSpeed.Minimum.Value && val <= UpDownSpeed.Maximum.Value) UpDownSpeed.Value = val; val = (decimal)(Settings.WaveformSmallJump.TotalMilliseconds); if (val >= UpDownJump.Minimum.Value && val <= UpDownJump.Maximum.Value) UpDownJump.Value = val; if (AvailableCultures != null && AvailableCultures.Length <= 1) { int index = AvailableCultures.Select((c, i) => new { c, i }).FirstOrDefault(p => p.c.DisplayName == LocalizeDictionary.Instance.Culture.DisplayName).i; LocalizationSelection.SelectedItem = preselectionCulture = AvailableCultures[index]; }else LocalizationBox.Visibility = System.Windows.Visibility.Collapsed; }