Пример #1
0
 public void refreshProjectsDropDown(Client client)
 {
     String label = null;
     if (projectDropDown.SelectedItem != null)
         label = projectDropDown.SelectedItem.Label;
     int index = 0;
     // CLear every items in the dropDown
     projectDropDown.Items.Clear();
     // Add empty item
     Microsoft.Office.Tools.Ribbon.RibbonDropDownItem emtyItem = this.Factory.CreateRibbonDropDownItem();
     projectDropDown.Items.Add(emtyItem);
     // Add items to the dropDown
     if (client != null)
     {
         // Add items to the dropDown
         foreach (Project project in client.Projects)
         {
             Microsoft.Office.Tools.Ribbon.RibbonDropDownItem item = this.Factory.CreateRibbonDropDownItem();
             item.Label = project.Name;
             projectDropDown.Items.Add(item);
             if (item.Label == label)
                 index = projectDropDown.Items.IndexOf(item);
         }
         // Reset the selection of the dropDown
         projectDropDown.SelectedItem = projectDropDown.Items[index];
     }
 }
Пример #2
0
 public static void AddClientProjectView(Client client, Project project, XML.Objects.Organisation.View view)
 {
     XmlDocument doc = init(parametersFilePath);
     XmlNode parent, node;
     XmlNodeList xmlNodeList = doc.SelectNodes("/root/Clients");
     XmlDocument tempDoc = new XmlDocument();
     parent = doc.SelectSingleNode("/root/Clients");
     tempDoc.LoadXml("<Client name='" + client + "'> <Project name='" + project +
         "'><View name='" + view.Name + "' tag='" + view.Tag + "'></View> </Project> </Client>");
     node = doc.ImportNode(tempDoc.FirstChild, true);
     parent.AppendChild(node);
     doc.Save(parametersFilePath);
 }
Пример #3
0
 private void clientDropDown_SelectionChanged(object sender, RibbonControlEventArgs e)
 {
     // Change the value of the client attribut
     RibbonDropDown drop = (sender as RibbonDropDown);
     RibbonDropDownItem it = drop.SelectedItem;
     foreach (Client client in XML.Global.Clients)
         if (client.Name == it.Label)
         {
             Client = client;
             refreshProjectsDropDown(Client);
             return;
         }
     Client = null;
     refreshProjectsDropDown(Client);
 }
Пример #4
0
 public static void removeClient(Client client)
 {
     XmlDocument doc = init(parametersFilePath);
     XmlNode node = doc.SelectSingleNode("/root/Clients/Client[@name='" + client + "']");
     node.ParentNode.RemoveChild(node);
     doc.Save(parametersFilePath);
 }
Пример #5
0
 public static void loadXmlProjects(Client client)
 {
     XmlDocument doc = init(parametersFilePath);
     XmlNodeList xmlNodeList = doc.SelectNodes("/root/Clients/Client[@name='" + client + "']/Project");
     List<Project> list = new List<Project>();
     foreach (XmlNode node in xmlNodeList)
     {
         string name = node.Attributes["name"].Value;
         Project project = new Project(name, client);
         loadXmlviews(project);
         list.Add(project);
     }
     client.Projects = list;
 }
Пример #6
0
 public static List<Client> loadXmlClients()
 {
     XmlDocument doc = init(parametersFilePath);
     XmlNodeList xmlNodeList = doc.SelectNodes("/root/Clients/Client");
     List<Client> list = new List<Client>();
     foreach (XmlNode node in xmlNodeList)
     {
         string name = node.Attributes["name"].Value;
         Client client = new Client(name);
         loadXmlProjects(client);
         list.Add(client);
     }
     return list;
 }
 private void refreshProjectList(Client client)
 {
     int index = projectListBox.SelectedIndex;
     int count = projectListBox.Items.Count;
     // CLear every items in the listBox
     projectListBox.Items.Clear();
     // Add views to the listBox
     if (client != null)
     foreach (XML.Objects.Organisation.Project project in client.Projects)
     {
         projectListBox.Items.Add(project);
     }
     // Reset the selection in the listBox to the next item
     if (projectListBox.Items.Count != 0)
     {
         if (projectListBox.SelectedItem == null)
             index = 0;
         else if ((projectListBox.SelectedItem as Project).Client != client)
             index = 0;
         else
             index += projectListBox.Items.Count - count;
         projectListBox.SelectedItem = projectListBox.Items[index];
     }
 }
Пример #8
0
 public Project(String name, Client client)
 {
     Name = name;
     Views = new List<View>();
     Client = client;
 }