示例#1
0
        public void TestSystemTemplates()
        {
            FileStorage fs = new FileStorage(
                Path.Combine(Path.GetTempPath(), "TestTemplatesService"));
            TemplatesService ts = new TemplatesService(fs);

            // Start service
            ts.Start();
            ICategoriesTemplatesProvider ctp = ts.CategoriesTemplateProvider;

            // We must have at least one template provider called 'Default'
            Dashboard dash = ctp.Load("Default dashboard");

            Assert.AreNotSame(dash, null);

            // Test we dont have a template
            bool found = ctp.Exists("NonExistingTemplate");

            Assert.AreEqual(found, false);

            // Test saving the default template
            dash.Name = "NewDefault";
            ctp.Save(dash);

            // Test loading a template from a file
            Dashboard newDefault = ctp.Load("NewDefault");

            Assert.AreEqual(newDefault.Name, "NewDefault");
        }
示例#2
0
        private void FillCategories()
        {
            int i     = 0;
            int index = 0;

            foreach (string template in  tpc.TemplatesNames)
            {
                tagscombobox.AppendText(template);
                //Setting the selected value to the default template
                if (template == "default")
                {
                    index = i;
                }
                i++;
            }
            tagscombobox.Active = index;
            if (Categories == null)
            {
                Categories = tpc.Load(SelectedCategory);
            }
        }
示例#3
0
        void HandleSelectionChanged(object sender, EventArgs e)
        {
            Dashboard selected;

            dashboardseditortreeview.Selection.GetSelected(out selectedIter);

            try {
                // Load using the template real name and not the display name
                selected = provider.Load(templates.GetValue(selectedIter, 2) as string);
            } catch (Exception ex) {
                Config.GUIToolkit.ErrorMessage(Catalog.GetString("Could not load dashboard"));
                return;
            }
            deletetemplatebutton.Visible = selected != null;
            buttonswidget.Sensitive      = selected != null;
            if (selected != null)
            {
                Save(true);
                deletetemplatebutton.Sensitive = !selected.Static;
                buttonswidget.Template         = selected;
            }
            loadedTemplate = selected;
        }