//public void AddUrl(string temp, string folder = "", string title = "") //{ // var list = temp.Split('\n'); // foreach (var item in list) // { // Uri uriResult; // var list2 = item.Split('\t'); // string url = list2[0]; // bool result = Uri.TryCreate(url, UriKind.Absolute, out uriResult); // if (result == false) // { // continue; // } // if (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps) // { // //string ext = Util.GetExtension(url); // //if (Util.IsMovie(ext) || Util.IsPicture(ext)) // { // //Console.WriteLine(temp); // _dispatcher.BeginInvoke(new Action(() => // { // string protocol = "HTTP"; // string ext = Util.GetExtension(url); // if(Util.IsLive(ext)) // { // protocol = "LIVE"; // } // DownloadData data = new DownloadData // { // URL = url, // Folder = folder, // Title = title, // Protocol = protocol // }; // viewmodel.AddFile(data); // }), (DispatcherPriority)10); // } // } // } //} public MainWindow() { InitializeComponent(); this.Closing += MainWindow_Closing; viewmodel = DownloadFileViewModel.SharedViewModel(); ; this.DataContext = viewmodel; viewmodel.DownloadFolder = Directory.GetCurrentDirectory() + "\\Download"; IPCTestServer.IPCTestServer.SetWindow(this); new Thread(() => { var server = new MyServer(); }).Start(); //if (false) //{ // cbw = new ClipBoardWatcher(); // cbw.DrawClipBoard += (sender, e) => // { // if (Clipboard.ContainsText()) // { // string temp = Clipboard.GetText(); // AddUrl(temp); // } // }; //} System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += dispatcherTimer_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 1); dispatcherTimer.Start(); }
public static DownloadFileViewModel SharedViewModel() { return(_viewModel ?? (_viewModel = new DownloadFileViewModel())); }
public static DownloadFileViewModel SharedViewModel() { return _viewModel ?? (_viewModel = new DownloadFileViewModel()); }