//<----------------- event to trigger when the listbox item id double clicked in the nav display >----------------- private void DirList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { listboxItem ListboxInstance = ((listboxItem)lstBoxFilesForCheckin.SelectedItem); string selectedDir = ListboxInstance.Str; if (ListboxInstance.selectionType == 1) { { if (selectedDir == "• •") { if (pathStack_.Count > 1) // don't pop off "Storage" { pathStack_.Pop(); } else { return; } } else { path = pathStack_.Peek() + "/" + selectedDir; pathStack_.Push(path); } // display path in Dir TextBlcok Path.Text = removeFirstDir(pathStack_.Peek()); // build message to get dirs and post it CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStack_.Peek()); translater.postMessage(msg); // build message to get files and post it msg.remove("command"); msg.add("command", "getFiles"); translater.postMessage(msg); statusBarText.Text = @"Sending Message from Client" + @"(" + msg.attributes["from"] + ") to Server : " + @"( " + msg.attributes["to"] + ")" + @" with Command : " + "getDirs " + msg.attributes["command"]; } } }
//----< function triggered when there is a selection in the display_view listbox >------- void PrintText(object sender, SelectionChangedEventArgs args) { ListBox ListboxType = sender as ListBox; if (ListboxType != null) { listboxItem listboxItemInstance = ((listboxItem)display_view.SelectedItem); FileInfo displayFileName = new FileInfo(listboxItemInstance.Str.ToString()); String fileToProcess = displayFileName.FullName; CsMessage msgf = new CsMessage(); msgf.add("to", CsEndPoint.toString(serverEndPoint)); msgf.add("from", CsEndPoint.toString(endPoint_)); msgf.add("command", "getfile"); msgf.add("name", listboxItemInstance.Str.ToString()); translater.postMessage(msgf); statusBarText.Text = @"Sending Message from Client" + @"(" + msgf.attributes["from"] + ") to Server : " + @"( " + msgf.attributes["to"] + ")" + @" with Command : " + msgf.attributes["command"]; } }