Task test7() { Task test7 = Task.Factory.StartNew(() => { Thread.Sleep(2000); Console.WriteLine("\n-----We close file1.-----\n"); }).ContinueWith((t) => { Dispatcher.Invoke((Action)(() => { CloseCheckin.refreshDisplay(); })); }).ContinueWith((t) => { Thread.Sleep(2000); Dispatcher.Invoke((Action)(() => { CloseCheckin.FileList.SelectedIndex = 0; })); }).ContinueWith((t) => { Thread.Sleep(2000); Dispatcher.Invoke((Action)(() => { MouseButtonEventArgs mouseEve = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left); mouseEve.RoutedEvent = ListBox.MouseDoubleClickEvent; CloseCheckin.FileList.RaiseEvent(mouseEve); })); }); return(test7); }
Task test5() { Task test5 = Task.Factory.StartNew(() => { Thread.Sleep(2000); Console.WriteLine("\n-----Now we do close checkin.-----\n"); Console.WriteLine("\n-----You can doubleclick the file in the filelist to do closing.------\n"); Console.WriteLine("\n-----We firstly close file3, since its children isn't closed yet it will fail.-----\n"); }).ContinueWith((t) => { Dispatcher.Invoke((Action)(() => { CloseCheckin.refreshDisplay(); })); }).ContinueWith((t) => { Thread.Sleep(2000); Dispatcher.Invoke((Action)(() => { CloseCheckin.FileList.SelectedIndex = 1; })); }).ContinueWith((t) => { Thread.Sleep(2000); Dispatcher.Invoke((Action)(() => { MouseButtonEventArgs mouseEve = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left); mouseEve.RoutedEvent = ListBox.MouseDoubleClickEvent; CloseCheckin.FileList.RaiseEvent(mouseEve); })); }); return(test5); }
//----< load getFiles processing into dispatcher dictionary >------ private void DispatcherLoadGetFiles() { Action <CsMessage> getFiles = (CsMessage rcvMsg) => { Action clrFiles = () => { NavRemote.clearFiles(); CloseCheckin.clearFiles(); }; Dispatcher.Invoke(clrFiles, new Object[] { }); var enumer = rcvMsg.attributes.GetEnumerator(); while (enumer.MoveNext()) { string key = enumer.Current.Key; if (key.Contains("file")) { Action <string> doFile = (string file) => { NavRemote.addFile(file); CloseCheckin.addFile(file); }; Dispatcher.Invoke(doFile, new Object[] { enumer.Current.Value }); } } }; addClientProc("getFiles", getFiles); }
////----< load getDirs processing into dispatcher dictionary >------- private void DispatcherLoadGetDirs() { Action <CsMessage> getDirs = (CsMessage rcvMsg) => { Action clrDirs = () => { //NavLocal.clearDirs(); NavRemote.clearDirs(); CloseCheckin.clearDirs(); }; Dispatcher.Invoke(clrDirs, new Object[] { }); var enumer = rcvMsg.attributes.GetEnumerator(); while (enumer.MoveNext()) { string key = enumer.Current.Key; if (key.Contains("dir")) { Action <string> doDir = (string dir) => { NavRemote.addDir(dir); CloseCheckin.addDir(dir); }; Dispatcher.Invoke(doDir, new Object[] { enumer.Current.Value }); } } Action insertUp = () => { NavRemote.insertParent(); CloseCheckin.insertParent(); }; Dispatcher.Invoke(insertUp, new Object[] { }); }; addClientProc("getDirs", getDirs); }
//----< click connect button in connect tab >------ private void Button_Click_Connect(object sender, RoutedEventArgs e) { // start Comm endPoint_ = new CsEndPoint(); endPoint_.machineAddress = "localhost"; endPoint_.port = Convert.ToInt32(txtMsg1.Text); NavRemote.navEndPoint_ = endPoint_; CloseCheckin.navEndPoint_ = endPoint_; QueryControl.navEndPoint_ = endPoint_; translater = new Translater(); translater.listen(endPoint_); // start processing messages processMessages(); // load dispatcher loadDispatcher(); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; pathStack_.Push("../Storage"); NavRemote.PathTextBlock.Text = "Storage"; NavRemote.pathStack_.Push("../Storage"); CloseCheckin.PathTextBlock.Text = "Storage"; CloseCheckin.pathStack_.Push("../Storage"); NavLocal.PathTextBlock.Text = "LocalStorage"; NavLocal.pathStack_.Push(""); NavLocal.localStorageRoot_ = "../../../../LocalStorage"; QueryControl.pathStack_.Push("../Storage"); saveFilesPath = translater.setSaveFilePath("../../../SaveFiles"); sendFilesPath = translater.setSendFilePath("../../../SendFiles"); NavLocal.refreshDisplay(); CloseCheckin.refreshDisplay(); NavRemote.refreshDisplay(); connectstatus.Text = "Connected! Port number is " + txtMsg1.Text; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\..\MainWindow.xaml" ((WpfApp1.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: #line 21 "..\..\..\MainWindow.xaml" ((System.Windows.Controls.TabControl)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TabControl_SelectionChanged); #line default #line hidden return; case 3: this.NavLocal = ((WpfApp1.LocalNavControl)(target)); return; case 4: this.CloseCheckin = ((WpfApp1.CloseCheckin)(target)); return; case 5: this.NavRemote = ((WpfApp1.RemoteNavControl)(target)); return; case 6: this.txtMsg1 = ((System.Windows.Controls.TextBox)(target)); #line 46 "..\..\..\MainWindow.xaml" this.txtMsg1.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txtMsg1_TextChanged); #line default #line hidden return; case 7: this.ConnectButton = ((System.Windows.Controls.Button)(target)); #line 47 "..\..\..\MainWindow.xaml" this.ConnectButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click_Connect); #line default #line hidden return; case 8: this.QueryControl = ((WpfApp1.QueryControl)(target)); return; case 9: this.ConnectStatus = ((System.Windows.Controls.Primitives.StatusBar)(target)); return; case 10: this.connectstatus = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }