Beispiel #1
0
        internal void saveBand(string name, Member[] members, AddBand view, bool isEdit)
        {
            if (name.Length == 0)
                {
                    showMessage(true, "Must enter a band name");
                    return;
                }
            else if (members.Length == 0)
                {
                    showMessage(true, "Must add at least one member");
                    return;
                }

            if (isEdit)
            {
                //get index and remove
                //int index = bands.IndexOf(bandHighlight);
                //bands.RemoveAt(index);

                //Change the band info
                bandHighlight.setName(name);

                //remove and re-add members
                bandHighlight.removeMembers();
                foreach (Member m in members)
                    bandHighlight.addMember(m);

                //remove all rows
                ((MainView)_current_view).removeAllRows();

                //Reintialize the window
                ((MainView)_current_view).initialize(bands.ToArray(), reviewers.ToArray());
                //Close the add band view
                close(view);

                //disable edit / delete buttons
                ((MainView)_current_view).disableDelete(MainView.BANDS_TAB);
                ((MainView)_current_view).disableEdit(MainView.BANDS_TAB);
            }
            else
            {
                //Create a temp band
                Band b = new Band(name, members.Length.ToString());
                //Add the member
                foreach (Member m in members)
                    b.addMember(m);
                //Add Band
                bands.Add(b);
                //Reintialize the window
                ((MainView)_current_view).initialize(bands.ToArray(), reviewers.ToArray());
                //Close the add band view
                close(view);
            }
            saveXML();
        }
Beispiel #2
0
        internal void removeMember(AddBand parent, AddMember view)
        {
            //Remove from addingMembers
            addingMembers.Remove(memberHighlight);

            //Remove all member rows from addBand view
            parent.removeAllRows();

            //Change the real model
            //bandHighlight.removeMembers();
            //foreach (Member m in addingMembers.ToArray())
              //  bandHighlight.addMember(m);

            //size
            bandHighlight.setSize(addingMembers.Count.ToString());

            //reset addingMembers
            //addingMembers = new List<Member>();

            //re-add rows
            foreach (Member m in addingMembers.ToArray())
            {
                addingMembers.Remove(m);
                addMemeberToAddBandView(m, parent);
            }

            //Close the form
            view.Close();

            //reinitiate the window
            //remove all rows
            ((MainView)_current_view).removeAllRows();

            //Reintialize the window
            ((MainView)_current_view).initialize(bands.ToArray(), reviewers.ToArray());

            //disable edit / delete buttons
            ((MainView)_current_view).disableDelete(MainView.BANDS_TAB);
            ((MainView)_current_view).disableEdit(MainView.BANDS_TAB);
        }
Beispiel #3
0
 internal void addMemeberToAddBandView(Member m, AddBand view)
 {
     MemberRow row = new MemberRow(m, this, view, true);
     addingMembers.Add(m);
     //Place row
     row.Top = view.getInsertHeight() + view.getNumberOfMembers() * row.Height;
     //Adjust height of window
     view.Height += row.Height;
     //Add row
     view.incrementMembers(row);
 }
Beispiel #4
0
 internal void editBand()
 {
     AddBand addBandView = new AddBand(bandHighlight.getName(), this);
     addingMembers = new List<Member>();
     foreach(Member m in bandHighlight.getMembers())
     {
         addMemeberToAddBandView(m,addBandView);
     }
     addBandView.Show();
 }
Beispiel #5
0
 internal void addBand()
 {
     AddBand addBandView = new AddBand(this);
     addingMembers = new List<Member>();
     addBandView.Show();
 }