Ejemplo n.º 1
0
 //
 // OnAddService
 //
 // This method is "Invoked" by OnBrowseReply.  This call
 // executes in the context of the main thread
 //
 private void OnAddService
 (
     BrowseData data
 )
 {
     browseList.Items.Add(data);
     browseList.Invalidate();
 }
Ejemplo n.º 2
0
        private void menuDel_Click(object sender, System.EventArgs e)
        {
            int idx = listBox.SelectedIndex;

            if (idx != -1)
            {
                if (MessageBox.Show("Do you want delete data?", "Question?",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    // smazat data
                    listBox.BeginUpdate();
                    DataList.RemoveAt(idx);
                    this.SetDataList(DataList);
                    listBox.EndUpdate();
                    listBox.Invalidate();
                }
            }
        }
Ejemplo n.º 3
0
        //
        // ServiceFound
        //
        // This call is invoked by the DNSService core.  We create
        // a BrowseData object and invoked the appropriate method
        // in the GUI thread so we can update the UI
        //
        public void ServiceFound
        (
            DNSSDService sref,
            DNSSDFlags flags,
            uint ifIndex,
            String serviceName,
            String regType,
            String domain
        )
        {
            BrowseData data = new BrowseData();

            data.InterfaceIndex = ifIndex;
            data.Name           = serviceName;
            data.Type           = regType;
            data.Domain         = domain;

            browseList.Items.Add(data);
            browseList.Invalidate();
        }
Ejemplo n.º 4
0
        //
        // ServiceFound
        //
        // This call is invoked by the DNSService core.  We create
        // a BrowseData object and invoked the appropriate method
        // in the GUI thread so we can update the UI
        //
        public void ServiceFound
        (
            DNSSDService sref,
            DNSSDFlags flags,
            uint ifIndex,
            String serviceName,
            String regType,
            String domain
        )
        {
            int index = browseList.Items.IndexOf(serviceName);

            //
            // Check to see if we've seen this service before. If the machine has multiple
            // interfaces, we could potentially get called back multiple times for the
            // same service. Implementing a simple reference counting scheme will address
            // the problem of the same service showing up more than once in the browse list.
            //
            if (index == -1)
            {
                BrowseData data = new BrowseData();

                data.InterfaceIndex = ifIndex;
                data.Name           = serviceName;
                data.Type           = regType;
                data.Domain         = domain;
                data.Refs           = 1;

                browseList.Items.Add(data);
                browseList.Invalidate();
            }
            else
            {
                BrowseData data = (BrowseData)browseList.Items[index];
                data.Refs++;
            }
        }
        private void TogglePackageSourceEnabled(int itemIndex, ListBox currentListBox)
        {
            if (itemIndex < 0 || itemIndex >= currentListBox.Items.Count)
            {
                return;
            }

            var item = (PackageSource)currentListBox.Items[itemIndex];
            item.IsEnabled = !item.IsEnabled;

            currentListBox.Invalidate(GetCheckBoxRectangleForListBoxItem(currentListBox, itemIndex));
        }