Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        //----< 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;
        }