////----< load getDirs processing into dispatcher dictionary >-------

        private void DispatcherLoadGetDirs()
        {
            Action <CsMessage> getDirs = (CsMessage rcvMsg) =>
            {
                Action clrDirs = () =>
                {
                    //NavLocal.clearDirs();
                    NavRemote.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);
                        };
                        Dispatcher.Invoke(doDir, new Object[] { enumer.Current.Value });
                    }
                }
                Action insertUp = () =>
                {
                    NavRemote.insertParent();
                };
                Dispatcher.Invoke(insertUp, new Object[] { });
            };

            addClientProc("getDirs", getDirs);
        }
Ejemplo n.º 2
0
        //---<Dispatcher to load query results>-----
        private void DispatcherLoadQueryResults()
        {
            Action <CsMessage> getResults = (CsMessage rcvMsg) =>
            {
                Action clrResults = () =>
                {
                    queryControl.fileList.Items.Clear();
                };
                Dispatcher.Invoke(clrResults, new Object[] { });
                var enumer = rcvMsg.attributes.GetEnumerator();
                Console.WriteLine("\nFile(s) obtianed from server:\n");
                Console.WriteLine("---------------------------------------------------");
                while (enumer.MoveNext())
                {
                    string key = enumer.Current.Key;
                    if (key.Contains("key"))
                    {
                        Action <string> doDir = (string dir) =>
                        {
                            Console.WriteLine(dir);
                            queryControl.fileList.Items.Add(dir);
                        };
                        Dispatcher.Invoke(doDir, new Object[] { enumer.Current.Value });
                    }
                }
                Action insertUp = () =>
                {
                    NavRemote.insertParent();
                };
                Dispatcher.Invoke(insertUp, new Object[] { });
            };

            addClientProc("queryResults", getResults);
        }