//----< load getFiles processing into dispatcher dictionary >------ private void DispatcherLoadGetFiles() { Action <CsMessage> getFiles = (CsMessage rcvMsg) => { Action clrFiles = () => { NavChkOut.clearFiles(); NavBrowse.clearFiles(); NavChkIn.clearFilesR(); }; 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) => { NavChkOut.addFile(file); NavBrowse.addFile(file); NavChkIn.addFileR(file); }; Dispatcher.Invoke(doFile, new Object[] { enumer.Current.Value }); } } }; addClientProc("getFiles", getFiles); }
//----< function to demonstrate all function requirements>---------------- public void testRequirements() { if (endPoint_.port == 8082) { Console.WriteLine("\n\n ==============================================="); Console.WriteLine(" Demonstrating Requirements "); Console.WriteLine(" ==============================================="); Console.WriteLine("\n\n Demonstrating Requirement No. 1 "); Console.WriteLine(" ====================================="); Console.WriteLine("\n Using Visual Studio 2017 and the standard C++ libraries. Also for client C#, WPF and C++\\CLI is used"); Console.WriteLine("\n\n Demonstrating Requirement No. 7 "); Console.WriteLine(" ====================================="); Console.WriteLine("\n Following automated test unit is sending requests one by one to demonstrate requirements"); Console.WriteLine("\n\n Demonstrating Requirement No. 4 "); Console.WriteLine(" ====================================="); Console.WriteLine("\n Sending connect to server message through message-passing communication system"); ConnectToServer(); Console.WriteLine("\n Demonstrating Requirement No. 5 "); Console.WriteLine(" ====================================="); Console.WriteLine("\n Sending \"Do Not Reply\" HTTP style one way asynchronous message"); donotReply(); Console.WriteLine("\n Demonstrating Requirement No. 6 "); Console.WriteLine(" ====================================="); Console.WriteLine("\n Following CheckIn, CheckOut and Browse requests will show sending or receiving block bytes in file transfer"); Console.WriteLine("\n Demonstrating Requirement No. 3"); Console.WriteLine(" ====================================="); Console.WriteLine("\n Provided Client GUI that enables user to Check-in, Check-out and Brwose files"); Console.WriteLine("\n Demonstrating Requirement No. 2 "); Console.WriteLine(" ====================================="); Console.WriteLine("\n Provided a Repository Server that provides functionality to check-in, check-out, and browse"); Console.WriteLine("\n Following CheckIn, CheckOut and Browse parts will demonstrate each functionality"); Console.WriteLine("\n This console will display Client side and server console will display Server side"); Console.WriteLine("\n\n Browse Part"); Console.WriteLine(" ====================="); NavBrowse.demoreqClient(); Console.WriteLine("\n\n Check-out Part"); Console.WriteLine(" ====================="); NavChkOut.demoreqClient(); Console.WriteLine("\n\n Check-in Part"); Console.WriteLine(" ====================="); NavChkIn.demoreqClient(); Console.WriteLine("\n\n===== This automated test unit demonstrated main cases in CheckIn, CheckOut and Browse parts ====="); Console.WriteLine("\n===== Please use GUI window for your demonstration of Remote Code Repository =====\n"); } }
//----< start Comm, fill window display with dirs and files >------ private void Window_Loaded(object sender, RoutedEventArgs e) { // start Comm try { NavChkOut.navEndPoint_ = endPoint_; NavBrowse.navEndPoint_ = endPoint_; NavChkIn.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"); NavChkOut.PathTextBlock.Text = "Storage"; NavChkOut.pathStack_.Push("../Storage"); NavChkIn.PathTextBlock.Text = "LocalStorage"; NavChkIn.pathStack_.Push(""); NavChkIn.localStorageRoot_ = "../../../../LocalStorage"; NavChkIn.pathStackRemote_.Push("../Storage"); NavBrowse.PathTextBlock.Text = "Storage"; NavBrowse.pathStack_.Push("../Storage"); saveFilesPath = translater.setSaveFilePath("../../../SaveFiles"); sendFilesPath = translater.setSendFilePath("../../../SendFiles"); NavChkIn.refreshDisplay(); NavChkOut.refreshDisplay(); NavBrowse.refreshDisplay(); NavChkIn.refreshDisplayRemote(); //Automated test suit to demonstrate all requirements testRequirements(); } catch (Exception ex) { txtStatusBar.Text = "Something is wrong..." + ex; } }
//----< load getDirs processing into dispatcher dictionary >------- private void DispatcherLoadGetDirs() { Action <CsMessage> getDirs = (CsMessage rcvMsg) => { Action clrDirs = () => { NavChkOut.clearDirs(); NavBrowse.clearDirs(); NavChkIn.clearDirsR(); }; 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) => { NavChkOut.addDir(dir); NavBrowse.addDir(dir); NavChkIn.addDirR(dir); }; Dispatcher.Invoke(doDir, new Object[] { enumer.Current.Value }); } } Action insertUp = () => { NavChkOut.insertParent(); NavBrowse.insertParent(); NavChkIn.insertParentR(); }; Dispatcher.Invoke(insertUp, new Object[] { }); }; addClientProc("getDirs", getDirs); }