/// <summary>\r
/// The is mouse over split element.\r
/// </summary>\r
- private bool IsMouseOverSplitElement;\r
+ private bool isMouseOverSplitElement;\r
\r
/// <summary>\r
/// The context menu.\r
/// </summary>\r
protected override void OnClick()\r
{\r
- if (this.IsMouseOverSplitElement)\r
+ if (this.isMouseOverSplitElement)\r
{\r
this.OpenButtonMenu();\r
}\r
/// </param>\r
private void SplitElement_MouseEnter(object sender, MouseEventArgs e)\r
{\r
- this.IsMouseOverSplitElement = true;\r
+ this.isMouseOverSplitElement = true;\r
}\r
\r
/// <summary>\r
/// </param>\r
private void SplitElement_MouseLeave(object sender, MouseEventArgs e)\r
{\r
- this.IsMouseOverSplitElement = false;\r
+ this.isMouseOverSplitElement = false;\r
}\r
\r
/// <summary>\r
\r
namespace HandBrakeWPF.Converters\r
{\r
+ using System;\r
using System.Globalization;\r
using System.IO;\r
using System.Windows.Data;\r
- using System;\r
\r
/// <summary>\r
/// Converts a Full Path to Filename only.\r
/// <summary>\r
/// The Options Tab Converter. Controls which tab is dispalyed.\r
/// </summary>\r
- class OptionsTabConverter : IValueConverter\r
+ public class OptionsTabConverter : IValueConverter\r
{\r
/// <summary>\r
/// Converts a value. \r
\r
namespace HandBrakeWPF.Converters\r
{\r
+ using System;\r
using System.Globalization;\r
using System.Windows;\r
using System.Windows.Data;\r
- using System;\r
-\r
using HandBrakeWPF.Services.Queue.Model;\r
\r
/// <summary>\r
}\r
\r
List<string> removeFiles = new List<string>();\r
- XmlSerializer Ser = new XmlSerializer(typeof(List<QueueTask>));\r
+ XmlSerializer ser = new XmlSerializer(typeof(List<QueueTask>));\r
foreach (FileInfo file in logFiles)\r
{\r
try\r
{\r
using (FileStream strm = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))\r
{\r
- List<QueueTask> list = Ser.Deserialize(strm) as List<QueueTask>;\r
+ List<QueueTask> list = ser.Deserialize(strm) as List<QueueTask>;\r
if (list != null && list.Count == 0)\r
{\r
removeFiles.Add(file.FullName);\r
}
/// <summary>
- /// The write file.
+ /// Verify the Encode Destination path exists and if not, create it.
/// </summary>
- /// <param name="content">
- /// The content.
- /// </param>
- /// <param name="fileName">
- /// The file name.
+ /// <param name="task">
+ /// The task.
/// </param>
- private void WriteFile(string content, string fileName)
+ /// <exception cref="Exception">
+ /// If the creation fails, an exception is thrown.
+ /// </exception>
+ protected void VerifyEncodeDestinationPath(EncodeTask task)
{
+ // Make sure the path exists, attempt to create it if it doesn't
try
{
- using (StreamWriter fileWriter = new StreamWriter(fileName) { AutoFlush = true })
+ string path = Directory.GetParent(task.Destination).ToString();
+ if (!Directory.Exists(path))
{
- fileWriter.Write(content);
+ Directory.CreateDirectory(path);
}
}
catch (Exception exc)
{
- Debug.WriteLine(exc);
+ throw new GeneralApplicationException(
+ "Unable to create directory for the encoded output.", "Please verify that you have a valid path.", exc);
}
}
/// <summary>
- /// Verify the Encode Destination path exists and if not, create it.
+ /// The write file.
/// </summary>
- /// <param name="task">
- /// The task.
+ /// <param name="content">
+ /// The content.
/// </param>
- /// <exception cref="Exception">
- /// If the creation fails, an exception is thrown.
- /// </exception>
- protected void VerifyEncodeDestinationPath(EncodeTask task)
+ /// <param name="fileName">
+ /// The file name.
+ /// </param>
+ private void WriteFile(string content, string fileName)
{
- // Make sure the path exists, attempt to create it if it doesn't
try
{
- string path = Directory.GetParent(task.Destination).ToString();
- if (!Directory.Exists(path))
+ using (StreamWriter fileWriter = new StreamWriter(fileName) { AutoFlush = true })
{
- Directory.CreateDirectory(path);
+ fileWriter.Write(content);
}
}
catch (Exception exc)
{
- throw new GeneralApplicationException(
- "Unable to create directory for the encoded output.", "Please verify that you have a valid path.", exc);
+ Debug.WriteLine(exc);
}
}
#region HandBrakeInstance Event Handlers.
+ /// <summary>
+ /// Service Log Message.
+ /// </summary>
+ /// <param name="message">Log message content</param>
+ protected void ServiceLogMessage(string message)
+ {
+ this.log.LogMessage(string.Format("{0}# {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info);
+ }
+
/// <summary>
/// Encode Progress Event Handler
/// </summary>
? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Destination)
: new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Destination));
}
-
- /// <summary>
- /// Service Log Message.
- /// </summary>
- /// <param name="message">Log message content</param>
- protected void ServiceLogMessage(string message)
- {
- this.log.LogMessage(string.Format("{0}# {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info);
- }
#endregion
}
}
return new VideoLevel(this.DisplayName, this.ShortName);
}
- /// <summary>
- /// The equals.
- /// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(VideoLevel other)
- {
- return string.Equals(this.ShortName, other.ShortName);
- }
-
/// <summary>
/// The equals.
/// </summary>
{
return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoLevel other)
+ {
+ return string.Equals(this.ShortName, other.ShortName);
+ }
}
}
return new VideoPreset(this.DisplayName, this.ShortName);
}
- /// <summary>
- /// The equals.
- /// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(VideoPreset other)
- {
- return string.Equals(this.ShortName, other.ShortName);
- }
-
/// <summary>
/// The equals.
/// </summary>
{
return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoPreset other)
+ {
+ return string.Equals(this.ShortName, other.ShortName);
+ }
}
}
return new VideoProfile(this.DisplayName, this.ShortName);
}
- /// <summary>
- /// The equals.
- /// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(VideoProfile other)
- {
- return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
- }
-
/// <summary>
/// The equals.
/// </summary>
return ((this.DisplayName != null ? this.DisplayName.GetHashCode() : 0) * 397) ^ (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
}
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoProfile other)
+ {
+ return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
+ }
}
}
return new VideoTune(this.DisplayName, this.ShortName);
}
- /// <summary>
- /// The equals.
- /// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(HandBrakeWPF.Services.Encode.Model.Models.Video.VideoProfile other)
- {
- return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
- }
-
- /// <summary>
- /// The equals.
- /// </summary>
- /// <param name="other">
- /// The other.
- /// </param>
- /// <returns>
- /// The <see cref="bool"/>.
- /// </returns>
- protected bool Equals(VideoTune other)
- {
- return string.Equals(this.ShortName, other.ShortName);
- }
-
/// <summary>
/// The equals.
/// </summary>
{
return (this.ShortName != null ? this.ShortName.GetHashCode() : 0);
}
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoTune other)
+ {
+ return string.Equals(this.ShortName, other.ShortName);
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(VideoProfile other)
+ {
+ return string.Equals(this.DisplayName, other.DisplayName) && string.Equals(this.ShortName, other.ShortName);
+ }
}
}
\r
#endregion\r
\r
- /// <summary>\r
- /// The equals.\r
- /// </summary>\r
- /// <param name="other">\r
- /// The other.\r
- /// </param>\r
- /// <returns>\r
- /// The <see cref="bool"/>.\r
- /// </returns>\r
- protected bool Equals(Preset other)\r
- {\r
- return string.Equals(this.Name, other.Name);\r
- }\r
-\r
/// <summary>\r
/// The equals.\r
/// </summary>\r
{\r
return (this.Name != null ? this.Name.GetHashCode() : 0);\r
}\r
+\r
+ /// <summary>\r
+ /// The equals.\r
+ /// </summary>\r
+ /// <param name="other">\r
+ /// The other.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The <see cref="bool"/>.\r
+ /// </returns>\r
+ protected bool Equals(Preset other)\r
+ {\r
+ return string.Equals(this.Name, other.Name);\r
+ }\r
}\r
}
\ No newline at end of file
}
}
- protected bool Equals(PresetDisplayCategory other)
- {
- return string.Equals(this.Category, other.Category);
- }
-
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
{
return (this.Category != null ? this.Category.GetHashCode() : 0);
}
+
+ protected bool Equals(PresetDisplayCategory other)
+ {
+ return string.Equals(this.Category, other.Category);
+ }
}
}
\r
// Orgamise the Presets list into Json Equivilent objects.\r
Dictionary<string, PresetCategory> presetCategories = new Dictionary<string, PresetCategory>();\r
- List<HBPreset> uncategorisedPresets = new List<HBPreset>(); \r
- foreach (Preset item in this.flatPresetList.Values.OrderBy(o => o.IsBuildIn)) // Handle User Presets first.\r
+ List<HBPreset> uncategorisedPresets = new List<HBPreset>();\r
+\r
+ // Handle User Presets first.\r
+ foreach (Preset item in this.flatPresetList.Values.OrderBy(o => o.IsBuildIn))\r
{\r
if (string.IsNullOrEmpty(item.Category))\r
{\r
\r
#endregion\r
\r
- /// <summary>\r
- /// The equals.\r
- /// </summary>\r
- /// <param name="other">\r
- /// The other.\r
- /// </param>\r
- /// <returns>\r
- /// The <see cref="bool"/>.\r
- /// </returns>\r
- protected bool Equals(QueueTask other)\r
- {\r
- return Equals(this.ScannedSourcePath, other.ScannedSourcePath) && Equals(this.Task, other.Task) && this.status == other.status;\r
- }\r
-\r
/// <summary>\r
/// The equals.\r
/// </summary>\r
return hashCode;\r
}\r
}\r
+\r
+ /// <summary>\r
+ /// The equals.\r
+ /// </summary>\r
+ /// <param name="other">\r
+ /// The other.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The <see cref="bool"/>.\r
+ /// </returns>\r
+ protected bool Equals(QueueTask other)\r
+ {\r
+ return Equals(this.ScannedSourcePath, other.ScannedSourcePath) && Equals(this.Task, other.Task) && this.status == other.status;\r
+ }\r
}\r
}
\ No newline at end of file
\r
#region Methods\r
\r
+ /// <summary>\r
+ /// The on queue completed.\r
+ /// </summary>\r
+ /// <param name="e">\r
+ /// The e.\r
+ /// </param>\r
+ protected virtual void OnQueueCompleted(QueueCompletedEventArgs e)\r
+ {\r
+ QueueCompletedEventDelegate handler = this.QueueCompleted;\r
+ if (handler != null)\r
+ {\r
+ handler(this, e);\r
+ }\r
+\r
+ this.IsProcessing = false;\r
+ }\r
+\r
+ /// <summary>\r
+ /// The on low diskspace detected.\r
+ /// </summary>\r
+ protected virtual void OnLowDiskspaceDetected()\r
+ {\r
+ this.LowDiskspaceDetected?.Invoke(this, EventArgs.Empty);\r
+ }\r
+\r
/// <summary>\r
/// After an encode is complete, move onto the next job.\r
/// </summary>\r
handler(this, e);\r
}\r
}\r
-\r
- /// <summary>\r
- /// The on queue completed.\r
- /// </summary>\r
- /// <param name="e">\r
- /// The e.\r
- /// </param>\r
- protected virtual void OnQueueCompleted(QueueCompletedEventArgs e)\r
- {\r
- QueueCompletedEventDelegate handler = this.QueueCompleted;\r
- if (handler != null)\r
- {\r
- handler(this, e);\r
- }\r
-\r
- this.IsProcessing = false;\r
- }\r
-\r
- /// <summary>\r
- /// The on low diskspace detected.\r
- /// </summary>\r
- protected virtual void OnLowDiskspaceDetected()\r
- {\r
- this.LowDiskspaceDetected?.Invoke(this, EventArgs.Empty);\r
- }\r
\r
/// <summary>\r
/// Run through all the jobs on the queue.\r
#region Private Methods
+ /// <summary>
+ /// The service log message.
+ /// </summary>
+ /// <param name="message">
+ /// The message.
+ /// </param>
+ protected void ServiceLogMessage(string message)
+ {
+ this.log.LogMessage(string.Format("{0} # {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info);
+ }
+
/// <summary>
/// Start a scan for a given source path and title
/// </summary>
#endregion
#region HandBrakeInstance Event Handlers
+
/// <summary>
/// Scan Completed Event Handler
/// </summary>
/// <returns>
/// The convert titles.
/// </returns>
- internal static List<Title> ConvertTitles(JsonScanObject titles)
+ private static List<Title> ConvertTitles(JsonScanObject titles)
{
List<Title> titleList = new List<Title>();
foreach (SourceTitle title in titles.TitleList)
return titleList;
}
-
- /// <summary>
- /// The service log message.
- /// </summary>
- /// <param name="message">
- /// The message.
- /// </param>
- protected void ServiceLogMessage(string message)
- {
- this.log.LogMessage(string.Format("{0} # {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info);
- }
#endregion
}
}
\ No newline at end of file
/// <summary>\r
/// The XML Serializer \r
/// </summary>\r
- readonly XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary<string, object>));\r
+ private readonly XmlSerializer serializer = new XmlSerializer(typeof(Collections.SerializableDictionary<string, object>));\r
\r
/// <summary>\r
/// The User Settings\r
Execute.dispatcher = (Dispatcher)null;
}
- /// <summary>
- /// The validate dispatcher.
- /// </summary>
- /// <exception cref="InvalidOperationException">
- /// Not initialized with dispatcher.
- /// </exception>
- private static void ValidateDispatcher()
- {
- if (Execute.dispatcher == null)
- throw new InvalidOperationException("Not initialized with dispatcher.");
- }
-
/// <summary>
/// Executes the action on the UI thread asynchronously.
/// </summary>
return (Task)taskSource.Task;
}
+ /// <summary>
+ /// Executes the action on the UI thread.
+ /// </summary>
+ /// <param name="action">The action to execute.</param>
+ public static void OnUIThread(this System.Action action)
+ {
+ if (Execute.executor != null)
+ Execute.executor(action);
+ else if (Execute.CheckAccess())
+ action();
+ else
+ Execute.OnUIThreadAsync(action).Wait();
+ }
+
/// <summary>
/// The check access.
/// </summary>
}
/// <summary>
- /// Executes the action on the UI thread.
+ /// The validate dispatcher.
/// </summary>
- /// <param name="action">The action to execute.</param>
- public static void OnUIThread(this System.Action action)
+ /// <exception cref="InvalidOperationException">
+ /// Not initialized with dispatcher.
+ /// </exception>
+ private static void ValidateDispatcher()
{
- if (Execute.executor != null)
- Execute.executor(action);
- else if (Execute.CheckAccess())
- action();
- else
- Execute.OnUIThreadAsync(action).Wait();
+ if (Execute.dispatcher == null)
+ throw new InvalidOperationException("Not initialized with dispatcher.");
}
}
}
this.NotifyOfPropertyChange(ExtensionMethods.GetMemberInfo((Expression)property).Name);
}
- /// <summary>
- /// Raises the <see cref="E:PropertyChanged"/> event directly.
- /// </summary>
- /// <param name="e">The <see cref="T:System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected void OnPropertyChanged(PropertyChangedEventArgs e)
- {
- PropertyChangedEventHandler changedEventHandler = this.PropertyChanged;
- if (changedEventHandler == null)
- return;
- changedEventHandler((object)this, e);
- }
-
/// <summary>
/// Called when the object is deserialized.
/// </summary>
{
return false;
}
+
+ /// <summary>
+ /// Raises the <see cref="E:PropertyChanged"/> event directly.
+ /// </summary>
+ /// <param name="e">The <see cref="T:System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void OnPropertyChanged(PropertyChangedEventArgs e)
+ {
+ PropertyChangedEventHandler changedEventHandler = this.PropertyChanged;
+ if (changedEventHandler == null)
+ return;
+ changedEventHandler((object)this, e);
+ }
}
}
this.NotifyOfPropertyChange(() => this.Task);\r
}\r
\r
+ /// <summary>\r
+ /// Add all remaining for selected languages.\r
+ /// </summary>\r
+ public void AddAllRemainingForSelectedLanguages()\r
+ {\r
+ // Add them if they are not already added.\r
+ foreach (Audio sourceTrack in this.GetSelectedLanguagesTracks())\r
+ {\r
+ // Step 2: Check if the track list already contrains this track\r
+ bool found = this.Task.AudioTracks.Any(audioTrack => Equals(audioTrack.ScannedTrack, sourceTrack));\r
+ if (!found)\r
+ {\r
+ // If it doesn't, add it.\r
+ this.Add(sourceTrack, true);\r
+ }\r
+ }\r
+ }\r
+\r
#endregion\r
\r
#region Methods\r
}\r
}\r
\r
- /// <summary>\r
- /// Add all remaining for selected languages.\r
- /// </summary>\r
- public void AddAllRemainingForSelectedLanguages()\r
- {\r
- // Add them if they are not already added.\r
- foreach (Audio sourceTrack in this.GetSelectedLanguagesTracks())\r
- {\r
- // Step 2: Check if the track list already contrains this track\r
- bool found = this.Task.AudioTracks.Any(audioTrack => Equals(audioTrack.ScannedTrack, sourceTrack));\r
- if (!found)\r
- {\r
- // If it doesn't, add it.\r
- this.Add(sourceTrack, true);\r
- }\r
- }\r
- }\r
-\r
/// <summary>\r
/// The get preferred audio track, or the first if none available.\r
/// </summary>\r
base.OnActivate();\r
}\r
\r
+ /// <summary>\r
+ /// Trigger a faster / smoother way of updating the log window.\r
+ /// </summary>\r
+ /// <param name="e">\r
+ /// The e.\r
+ /// </param>\r
+ protected virtual void OnLogMessageReceived(LogEventArgs e)\r
+ {\r
+ var onLogMessageReceived = this.LogMessageReceived;\r
+ if (onLogMessageReceived != null)\r
+ {\r
+ onLogMessageReceived.Invoke(this, e);\r
+ }\r
+ }\r
+\r
/// <summary>\r
/// Handle the OnDeactivate Caliburn Event\r
/// </summary>\r
});\r
}\r
}\r
-\r
- /// <summary>\r
- /// Trigger a faster / smoother way of updating the log window.\r
- /// </summary>\r
- /// <param name="e">\r
- /// The e.\r
- /// </param>\r
- protected virtual void OnLogMessageReceived(LogEventArgs e)\r
- {\r
- var onLogMessageReceived = this.LogMessageReceived;\r
- if (onLogMessageReceived != null)\r
- {\r
- onLogMessageReceived.Invoke(this, e);\r
- }\r
- }\r
}\r
}
\ No newline at end of file
}\r
}\r
\r
+ /// <summary>\r
+ /// The process drive.\r
+ /// </summary>\r
+ /// <param name="item">\r
+ /// The item.\r
+ /// </param>\r
+ public void ProcessDrive(object item)\r
+ {\r
+ if (item != null)\r
+ {\r
+ if (item.GetType() == typeof(DriveInformation))\r
+ {\r
+ this.StartScan(((DriveInformation)item).RootDirectory, 0);\r
+ }\r
+ else if (item.GetType() == typeof(SourceMenuItem))\r
+ {\r
+ DriveInformation driveInfo = ((SourceMenuItem)item).Tag as DriveInformation;\r
+ if (driveInfo != null)\r
+ {\r
+ this.StartScan(driveInfo.RootDirectory, this.TitleSpecificScan);\r
+ }\r
+\r
+ this.ShowSourceSelection = false;\r
+ }\r
+ }\r
+ }\r
+\r
#endregion\r
\r
#region Private Methods\r
});\r
}\r
\r
- /// <summary>\r
- /// The process drive.\r
- /// </summary>\r
- /// <param name="item">\r
- /// The item.\r
- /// </param>\r
- public void ProcessDrive(object item)\r
- {\r
- if (item != null)\r
- {\r
- if (item.GetType() == typeof(DriveInformation))\r
- {\r
- this.StartScan(((DriveInformation)item).RootDirectory, 0);\r
- }\r
- else if (item.GetType() == typeof(SourceMenuItem))\r
- {\r
- DriveInformation driveInfo = ((SourceMenuItem)item).Tag as DriveInformation;\r
- if (driveInfo != null)\r
- {\r
- this.StartScan(driveInfo.RootDirectory, this.TitleSpecificScan);\r
- }\r
-\r
- this.ShowSourceSelection = false;\r
- }\r
- }\r
- }\r
-\r
/// <summary>\r
/// Allows the main window to respond to setting changes.\r
/// </summary>\r
\r
#region Public Methods\r
\r
- /// <summary>\r
- /// Load / Update the user settings.\r
- /// </summary>\r
- protected override void OnActivate()\r
- {\r
- this.OnLoad();\r
- base.OnActivate();\r
- }\r
-\r
/// <summary>\r
/// Close this window.\r
/// </summary>\r
/// </summary>\r
public void BrowseWhenDoneAudioFile()\r
{\r
- OpenFileDialog dialog = new OpenFileDialog() { Filter = "All Files|*.wav;*.mp3", FileName = this.WhenDoneAudioFileFullPath };\r
+ OpenFileDialog dialog = new OpenFileDialog() { Filter = "All Files|*.wav;*.mp3", FileName = this.WhenDoneAudioFileFullPath };\r
bool? dialogResult = dialog.ShowDialog();\r
if (dialogResult.HasValue && dialogResult.Value)\r
{\r
this.SelectedTab = tab;\r
}\r
\r
+ /// <summary>\r
+ /// Load / Update the user settings.\r
+ /// </summary>\r
+ protected override void OnActivate()\r
+ {\r
+ this.OnLoad();\r
+ base.OnActivate();\r
+ }\r
+\r
/// <summary>\r
/// Save the settings selected\r
/// </summary>\r
\r
#region Constants and Fields\r
\r
- private readonly Subtitle ForeignAudioSearchTrack;\r
+ private readonly Subtitle foreignAudioSearchTrack;\r
private IList<Subtitle> sourceTracks;\r
\r
#endregion\r
this.Langauges = LanguageUtilities.MapLanguages().Keys;\r
this.CharacterCodes = CharCodesUtilities.GetCharacterCodes();\r
\r
- this.ForeignAudioSearchTrack = new Subtitle { SubtitleType = SubtitleType.ForeignAudioSearch, Language = "Foreign Audio Search" };\r
- this.SourceTracks = new List<Subtitle> { this.ForeignAudioSearchTrack };\r
+ this.foreignAudioSearchTrack = new Subtitle { SubtitleType = SubtitleType.ForeignAudioSearch, Language = "Foreign Audio Search" };\r
+ this.SourceTracks = new List<Subtitle> { this.foreignAudioSearchTrack };\r
}\r
\r
#endregion\r
// Add Foreign Audio Scan\r
if (this.SubtitleBehaviours.AddForeignAudioScanTrack)\r
{\r
- this.Add(ForeignAudioSearchTrack);\r
+ this.Add(foreignAudioSearchTrack);\r
}\r
\r
// Add Track Behaviours\r
public void SetSource(Source source, Title title, Preset preset, EncodeTask task)\r
{\r
this.SourceTracks.Clear();\r
- this.SourceTracks.Add(ForeignAudioSearchTrack);\r
+ this.SourceTracks.Add(foreignAudioSearchTrack);\r
foreach (Subtitle subtitle in title.Subtitles)\r
{\r
this.SourceTracks.Add(subtitle);\r
\r
if (source == null)\r
{\r
- source = ForeignAudioSearchTrack;\r
+ source = foreignAudioSearchTrack;\r
}\r
\r
SubtitleTrack track = new SubtitleTrack\r
{\r
this.InitializeComponent();\r
\r
-\r
-\r
IUserSettingService userSettingService = IoC.Get<IUserSettingService>();\r
bool minimiseToTray = userSettingService.GetUserSetting<bool>(UserSettingConstants.MainWindowMinimize);\r
\r
if (minimiseToTray)\r
{\r
-\r
INotifyIconService notifyIconService = IoC.Get<INotifyIconService>();\r
this.notifyIcon = new NotifyIcon();\r
this.notifyIcon.ContextMenu = new ContextMenu(new[] { new MenuItem("Restore", NotifyIconClick), new MenuItem("Mini Status Display", ShowMiniStatusDisplay) });\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Check with the user before closing.\r
+ /// </summary>\r
+ /// <param name="e">\r
+ /// The CancelEventArgs.\r
+ /// </param>\r
+ protected override void OnClosing(CancelEventArgs e)\r
+ {\r
+ IShellViewModel shellViewModel = this.DataContext as IShellViewModel;\r
+\r
+ if (shellViewModel != null)\r
+ {\r
+ bool canClose = shellViewModel.CanClose();\r
+ if (!canClose)\r
+ {\r
+ e.Cancel = true;\r
+ }\r
+ }\r
+\r
+ if (this.notifyIcon != null)\r
+ {\r
+ this.notifyIcon.Visible = false;\r
+ }\r
+\r
+ base.OnClosing(e);\r
+ }\r
+\r
/// <summary>\r
/// The show mini status display.\r
/// </summary>\r
}\r
}\r
}\r
-\r
- /// <summary>\r
- /// Check with the user before closing.\r
- /// </summary>\r
- /// <param name="e">\r
- /// The CancelEventArgs.\r
- /// </param>\r
- protected override void OnClosing(CancelEventArgs e)\r
- {\r
- IShellViewModel shellViewModel = this.DataContext as IShellViewModel;\r
-\r
- if (shellViewModel != null)\r
- {\r
- bool canClose = shellViewModel.CanClose();\r
- if (!canClose)\r
- {\r
- e.Cancel = true;\r
- }\r
- }\r
-\r
- if (this.notifyIcon != null)\r
- {\r
- this.notifyIcon.Visible = false;\r
- }\r
-\r
- base.OnClosing(e);\r
- }\r
}\r
}\r