forked from Cinchoo/ChoEazyCopy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Create new task file from predefined templates. 2. Queue multiple tasks, run them sequential one after another. 3. MRU (Most recently used) backup tasks folders to choose from under Backup Tasks tab.
- Loading branch information
Showing
19 changed files
with
1,920 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
using System.Windows.Threading; | ||
|
||
namespace ChoEazyCopy | ||
{ | ||
public class ChoMruComboBox : Control | ||
{ | ||
|
||
#region Dependency Properties | ||
|
||
public static readonly DependencyProperty MruSourceProperty = | ||
DependencyProperty.Register("MruSource", typeof(ChoObservableMruList<string>), typeof(ChoMruComboBox)); | ||
|
||
public static readonly DependencyProperty TextProperty = | ||
DependencyProperty.Register("Text", typeof(string), typeof(ChoMruComboBox), new PropertyMetadata(OnTextChanged)); | ||
|
||
#endregion | ||
|
||
#region Constructors | ||
|
||
static ChoMruComboBox() | ||
{ | ||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ChoMruComboBox), new FrameworkPropertyMetadata(typeof(ChoMruComboBox))); | ||
} | ||
|
||
public ChoMruComboBox() | ||
{ | ||
|
||
this.Focusable = false; | ||
this.IsTabStop = false; | ||
|
||
} | ||
|
||
#endregion | ||
|
||
#region Properties | ||
|
||
public ChoObservableMruList<string> MruSource | ||
{ | ||
get { return (ChoObservableMruList<string>)GetValue(MruSourceProperty); } | ||
set { SetValue(MruSourceProperty, value); } | ||
} | ||
|
||
public string Text | ||
{ | ||
get { return (string)GetValue(TextProperty); } | ||
set { SetValue(TextProperty, value); } | ||
} | ||
|
||
#endregion | ||
|
||
#region Event Handlers | ||
|
||
private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
|
||
ChoMruComboBox srcControl = d as ChoMruComboBox; | ||
if (srcControl != null) | ||
{ | ||
if (srcControl.MruSource != null) | ||
{ | ||
var dir = e.NewValue.ToString(); | ||
|
||
if (!dir.IsNullOrWhiteSpace() && Directory.Exists(dir)) | ||
srcControl.MruSource.Add(dir); | ||
} | ||
} | ||
|
||
} | ||
private static void OnTextChanged1(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
ChoMruComboBox srcControl = d as ChoMruComboBox; | ||
if (srcControl != null) | ||
{ | ||
if (srcControl.MruSource != null) | ||
{ | ||
System.Threading.ThreadPool.RegisterWaitForSingleObject(new AutoResetEvent(false), | ||
(state, bTimeout) => srcControl.HandleMruUpdate(e.NewValue.ToString()), "", TimeSpan.FromSeconds(1), true); | ||
} | ||
} | ||
} | ||
private void HandleMruUpdate(string listVal) | ||
{ | ||
if (this.Dispatcher.CheckAccess()) | ||
{ | ||
if (Directory.Exists(listVal)) | ||
this.MruSource.Add(listVal); | ||
} | ||
else | ||
{ | ||
this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action<string>(HandleMruUpdate), listVal); | ||
} | ||
} | ||
#endregion | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.