コード例 #1
0
        private Peer startPeer(String overlay, Boolean isGateway)
        {
            int port = Int32.Parse(portBox.Text);
            bool client = radioClient.IsChecked.Value;
            bool bootstrap = bootstrapBox.IsChecked.Value;
            bool webServer = webserverActiveBox.IsChecked.Value;
            if (webServer == true)
                webserverActiveBox.IsChecked = false;

            Peer newPeer = new Peer(port, isGateway, client, bootstrap, webServer, overlay);
            peerList.Add(newPeer);

            TabItem tabView = new TabItem();

            RichTextBox textView = new RichTextBox();
            textView.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            textView.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            textView.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            // use find button
            //textView.TextChanged += new TextChangedEventHandler(LogTextChanged);

            tabView.Header = "Joining...";
            tabView.Content = textView;
            tabView.MouseRightButtonDown += new MouseButtonEventHandler(tabview_context);

            tabControl.Items.Add(tabView);
            tabControl.SelectedItem = tabView;

            newPeer.logTab = tabView;
            newPeer.TabID = IDcounter;
            //newPeer.OverlayName = OverlayName;
            //newPeer.storedDataTree = storedDataTree;
            newPeer.window = this;

            IDcounter++;

            if (autoIncBox.IsChecked == true)
            {
                portBox.Text = (UInt32.Parse(portBox.Text) + 1).ToString();
            }

            newPeer.start();

            return newPeer;

        }