Example #1
0
 public AppListBoxItem()
 {
     app_item_data_l = new AppItem();
 }
Example #2
0
        public void LoadAppItems()
        {
            app_items = new List <AppItem>();

            if (File.Exists(saved_app_items_path))
            {
                FileStream app_items_file = new FileStream(saved_app_items_path, FileMode.Open, FileAccess.Read);
                XmlReader  app_items_xml  = XmlReader.Create(app_items_file);

                bool    app_item_parent_found = false;
                String  temp_value            = "";
                AppItem temp_app_item         = null;

                while (app_items_xml.Read())
                {
                    if (app_items_xml.IsStartElement() && app_items_xml.Name == "AppItem")
                    {
                        // Signal that a parent AppItem was found.
                        app_item_parent_found = true;

                        // Reset for the next AppItem.
                        temp_app_item = new AppItem();
                    }

                    if (app_item_parent_found && app_items_xml.IsStartElement())
                    {
                        if (app_items_xml.Name == "AppPath")
                        {
                            // Read in the application executable path.
                            temp_value            = app_items_xml.ReadElementContentAsString();
                            temp_app_item.AppPath = temp_value;
                        }
                        else if (app_items_xml.Name == "AppTitle")
                        {
                            // Read in the application title.
                            temp_value             = app_items_xml.ReadElementContentAsString();
                            temp_app_item.AppTitle = temp_value;
                        }
                        else if (app_items_xml.Name == "AppArgs")
                        {
                            // Read in the application arguments.
                            temp_value = app_items_xml.ReadElementContentAsString();

                            // Bug: Blank arguments being passed to application.
                            temp_app_item.AppArgs = temp_value.Trim();
                        }
                    }

                    if (app_items_xml.NodeType == XmlNodeType.EndElement && app_items_xml.Name == "AppItem")
                    {
                        // Signal the end of a app item.
                        app_item_parent_found = false;

                        // Add the loaded AppItem to the list.
                        app_items.Add(temp_app_item);
                    }
                }

                app_items_file.Close();
            }
        }