Beispiel #1
0
        private void menuAddInterest_Click(object sender, EventArgs e)
        {
            DialogResult ret = DialogResult.None;

            try
            {
                ret = ps.addInterestWindow.ShowDialog();
            }
            catch (Exception)
            {
                Debug.WriteLine("Could not show addInterest dialog");
            }

            if (ret == DialogResult.OK)
            {
                int retval = 0;

                Haggle.Attribute.AttributeList al = ps.addInterestWindow.getAddInterests();

                foreach (Haggle.Attribute a in al.AsArray())
                {
                    Debug.WriteLine("Add interest: " + a.ToString());
                }

                if (al.Size() > 0)
                {
                    retval = ps.hh.AddInterests(al);

                    Debug.WriteLine("Add interests returned: " + retval);
                }
                al = ps.addInterestWindow.getDelInterests();

                foreach (Haggle.Attribute a in al.AsArray())
                {
                    Debug.WriteLine("Delete interest: " + a.ToString());
                }

                if (al.Size() > 0)
                {
                    retval = ps.hh.DeleteInterests(al);

                    Debug.WriteLine("Delete interests returned: " + retval);

                    photoListView.Clear();
                    ps.dataObjects.Clear();
                    ps.addInterestWindow.interestListView.Clear();
                    ps.hh.RequestInterests();
                    ps.hh.RequestDataObjects();
                }
            }
        }
Beispiel #2
0
        private void menuItem1_Click(object sender, EventArgs e)
        {
            if (delInterestList.Size() > 0 || addInterestList.Size() > 0)
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.Cancel;
            }

            menuItem1.Text = "Cancel";
            this.Close();
        }