コード例 #1
0
ファイル: scrfrm.cs プロジェクト: c3pio-qost/Rein-Corp-Client
        public void one_to_one(Object Arg)
        {
            try
            {
                GlobalTypes.ClientInfo tmp = Arg as GlobalTypes.ClientInfo;
                Client = new UdpClient(tmp.HostInfo.ScreenPort);                                                                 //port for exchange picture in onetoone mode
                Client.Client.ReceiveTimeout = 3000;

                while (Visible)
                {
                    GlobalTypes.ScreenPart recent_struct = RCScreenClient.receive_from <GlobalTypes.ScreenPart>(Client);

                    //if(thr_One_To_One.ThreadState!=ThreadState.AbortRequested)
                    if (recent_struct.Buffer != null)
                    {
                        Bitmap bmp = RCScreenClient.buf_to_bitmap(recent_struct.Buffer);
                        Screen_Box.BeginInvoke(new MethodInvoker(delegate()                          //paint received picture
                        {
                            show_pic(
                                bmp,
                                recent_struct.Point.X,
                                recent_struct.Point.Y
                                );
                        }));
                    }
                }
                Client.Client.Shutdown(SocketShutdown.Both);
                Client.Close();
            }
            catch (Exception ex) { }
        }
コード例 #2
0
 private static void cnt_elem_refr(GlobalTypes.HostInfo host_inf,
                                   GlobalTypes.SysMessageStruct msg,
                                   GlobalTypes.ClientInfo item,
                                   bool flag)
 {
     if ((Encoding.UTF8.GetString(msg.Msg) == "SYN") && (msg.Flag == 2))
     {
         if (!flag)
         {
             item = new GlobalTypes.ClientInfo(host_inf);
             lock (MainWindow.Client_Catalog)
             {
                 MainWindow.Client_Catalog.Add(item);
             }
             RCScreenClient.paint_thmb_scr(item);
         }
         else
         {
             lock (MainWindow.Client_Catalog)
             {
                 item.HostInfo       = host_inf;
                 item.LastConnection = DateTime.Now;
             }
         }
         lock (XPorter.Bus.Main_Handle.TreeUngroup)
         {
             XPorter.Bus.Main_Handle.TreeUngroup.Dispatcher.BeginInvoke(new MethodInvoker(delegate()
             {
                 System.Windows.Controls.ContextMenu item_menu = ReinCorpDesign.sources.UserContextMenu.get_contx_menu(item);
                 if (XPorter.Bus.Main_Handle.TreeUngroup.IsExpanded == false)
                 {
                     XPorter.Bus.Main_Handle.TreeUngroup.IsExpanded = true;
                 }
                 TreeViewItem tr_item = new TreeViewItem();
                 tr_item.ContextMenu  = item_menu;
                 tr_item.Header       = item.HostInfo.Addr.ToString();
                 tr_item.Tag          = "3";
                 XPorter.Bus.Main_Handle.TreeUngroup.Items.Add(tr_item);
             }));
         }
         Thread   thr_tmp = new Thread(RCScreenClient.get_query);
         Object[] args    = new Object[2];
         args[0]      = item;
         args[1]      = new GlobalTypes.ServiceMessageStruct("GET", 0);
         thr_tmp.Name = "get_query";
         thr_tmp.SetApartmentState(ApartmentState.STA);
         //thr_tmp.Start(args);
     }
 }
コード例 #3
0
            public static void cn_connect_click(object sender, RoutedEventArgs e)
            {
                System.Net.IPAddress address;
                System.Net.IPAddress.TryParse(
                    ((TextBox)Cntr.Template.FindName("Address", Cntr)).Text, out address);
                if (address != null)
                {
                    ContentControl connector_panel = (ContentControl)((Button)sender).TemplatedParent;
                    ((Panel)connector_panel.Parent).Children.Remove(connector_panel);
                    Cntr = null;
                    XPorter.Bus.Is_Main_Menu_Enabled          = true;
                    XPorter.Bus.Main_Handle.Sidebar.IsEnabled = true;

                    RCScreenClient.start_one_to_one(
                        new GlobalTypes.ClientInfo(new GlobalTypes.HostInfo(address, "Here was getInfo")));
                }
            }