Пример #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
		public static void LoadDashboards (ICategoriesTemplatesProvider provider)
		{
			foreach (IAnalisysDashboardsProvider plugin in AddinManager.GetExtensionObjects<IAnalisysDashboardsProvider> ()) {
				foreach (Dashboard dashboard in plugin.Dashboards) {
					dashboard.Static = true;
					provider.Register (dashboard);
				}
			}
		}
Пример #3
0
        public void TemplatesProvider_CopyStaticTemplate_CopyIsNotStatic()
        {
            // Arrange
            TemplatesService ts = new TemplatesService(storage);

            ts.Start();
            ICategoriesTemplatesProvider ctp = ts.CategoriesTemplateProvider;
            Dashboard dash = ctp.Templates [0];

            // Action
            ctp.Copy(dash, "NEW");

            // Assert
            Assert.IsTrue(dash.Static);
            Dashboard dash2 = ctp.Templates.Where(t => t.Name == "NEW").First();

            Assert.IsFalse(dash2.Static);
        }
Пример #4
0
        public void TestSystemTemplates()
        {
            TemplatesService ts = new TemplatesService(storage);

            // Start service
            ts.Start();
            ICategoriesTemplatesProvider ctp = ts.CategoriesTemplateProvider;
            // We must have at least one template provider called 'Default'
            Dashboard dash = ctp.Templates [0];

            Assert.IsNotNull(dash);
            // Test we dont have a template
            Assert.IsFalse(ctp.Exists("NonExistingTemplate"));

            ITeamTemplatesProvider ttp = ts.TeamTemplateProvider;

            Assert.AreEqual(2, ttp.Templates.Count);
            // Test we dont have a template
            Assert.IsFalse(ctp.Exists("NonExistingTemplate"));
        }
Пример #5
0
 public static void LoadDashboards(ICategoriesTemplatesProvider provider)
 {
     foreach (IAnalisysDashboardsProvider plugin in AddinManager.GetExtensionObjects<IAnalisysDashboardsProvider> ()) {
         foreach (Dashboard dashboard in plugin.Dashboards) {
             dashboard.Static = true;
             provider.Register (dashboard as DashboardLongoMatch);
         }
     }
 }
Пример #6
0
        public SportsTemplatesPanel()
        {
            this.Build();
            provider = Config.CategoriesTemplatesProvider;

            // Assign images
            panelheader1.ApplyVisible = false;
            panelheader1.Title        = Catalog.GetString("ANALYSIS DASHBOARDS MANAGER");
            panelheader1.BackClicked += (sender, o) => {
                Save(true);
                if (BackEvent != null)
                {
                    BackEvent();
                }
            };

            templateimage.Pixbuf       = Helpers.Misc.LoadIcon("longomatch-template-header", 54, IconLookupFlags.ForceSvg);
            categoryheaderimage.Pixbuf = Helpers.Misc.LoadIcon("longomatch-category-header", 47, IconLookupFlags.ForceSvg);
            newtemplateimage.Pixbuf    = Helpers.Misc.LoadIcon("longomatch-template-add", 36, IconLookupFlags.ForceSvg);
            importtemplateimage.Pixbuf = Helpers.Misc.LoadIcon("longomatch-template-import", 36, IconLookupFlags.ForceSvg);
            deletetemplateimage.Pixbuf = Helpers.Misc.LoadIcon("longomatch-template-delete", 36, IconLookupFlags.ForceSvg);
            savetemplateimage.Pixbuf   = Helpers.Misc.LoadIcon("longomatch-template-save", 36, IconLookupFlags.ForceSvg);
            addcategoryimage.Pixbuf    = Helpers.Misc.LoadIcon("longomatch-tag-category", 36, IconLookupFlags.ForceSvg);
            addtagimage.Pixbuf         = Helpers.Misc.LoadIcon("longomatch-tag-tag", 36, IconLookupFlags.ForceSvg);
            scoreimage.Pixbuf          = Helpers.Misc.LoadIcon("longomatch-tag-score", 36, IconLookupFlags.ForceSvg);
            cardimage.Pixbuf           = Helpers.Misc.LoadIcon("longomatch-tag-card", 36, IconLookupFlags.ForceSvg);
            timerimage.Pixbuf          = Helpers.Misc.LoadIcon("longomatch-tag-timer", 36, IconLookupFlags.ForceSvg);
            vseparatorimage.Pixbuf     = Helpers.Misc.LoadIcon("vertical-separator", 54, IconLookupFlags.ForceSvg);

            // Connect buttons from the bar
            newtemplatebutton.Entered    += HandleEnterTemplateButton;
            newtemplatebutton.Left       += HandleLeftTemplateButton;
            importtemplatebutton.Entered += HandleEnterTemplateButton;
            importtemplatebutton.Left    += HandleLeftTemplateButton;
            deletetemplatebutton.Entered += HandleEnterTemplateButton;
            deletetemplatebutton.Left    += HandleLeftTemplateButton;
            savetemplatebutton.Entered   += HandleEnterTemplateButton;
            savetemplatebutton.Left      += HandleLeftTemplateButton;

            addcategorybutton.Entered += HandleEnterTagButton;
            addcategorybutton.Left    += HandleLeftTagButton;
            addcategorybutton.Clicked += (object sender, EventArgs e) =>
                                         buttonswidget.AddButton("Category");
            addtagbutton1.Entered += HandleEnterTagButton;
            addtagbutton1.Left    += HandleLeftTagButton;
            addtagbutton1.Clicked += (object sender, EventArgs e) =>
                                     buttonswidget.AddButton("Tag");
            scorebutton.Entered += HandleEnterTagButton;
            scorebutton.Left    += HandleLeftTagButton;
            scorebutton.Clicked += (object sender, EventArgs e) =>
                                   buttonswidget.AddButton("Score");
            cardbutton.Entered += HandleEnterTagButton;
            cardbutton.Left    += HandleLeftTagButton;
            cardbutton.Clicked += (object sender, EventArgs e) =>
                                  buttonswidget.AddButton("Card");
            timerbutton.Entered += HandleEnterTagButton;
            timerbutton.Left    += HandleLeftTagButton;
            timerbutton.Clicked += (object sender, EventArgs e) =>
                                   buttonswidget.AddButton("Timer");

            templates = new ListStore(typeof(Pixbuf), typeof(string), typeof(string), typeof(bool));

            // Connect treeview with Model and configure
            dashboardseditortreeview.Model          = templates;
            dashboardseditortreeview.HeadersVisible = false;
            var cell = new CellRendererText {
                SizePoints = 14.0
            };

            //cell.Editable = true;
            cell.Edited += HandleEdited;
            var col = dashboardseditortreeview.AppendColumn("Text", cell, "text", 1);

            col.AddAttribute(cell, "editable", 3);
            dashboardseditortreeview.SearchColumn    = 0;
            dashboardseditortreeview.EnableGridLines = TreeViewGridLines.None;
            dashboardseditortreeview.CursorChanged  += HandleSelectionChanged;

            templatesvbox.WidthRequest = 160;

            buttonswidget.Sensitive      = false;
            buttonswidget.ButtonsVisible = false;
            buttonswidget.Mode           = DashboardMode.Edit;
            newtemplatebutton.Visible    = true;
            deletetemplatebutton.Visible = false;

            newtemplatebutton.Clicked    += HandleNewTemplateClicked;
            importtemplatebutton.Clicked += HandleImportTemplateClicked;
            deletetemplatebutton.Clicked += HandleDeleteTemplateClicked;
            savetemplatebutton.Clicked   += (sender, e) => Save(false);

            editdashboardslabel.ModifyFont(FontDescription.FromString(Config.Style.Font + " 9"));
            editbuttonslabel.ModifyFont(FontDescription.FromString(Config.Style.Font + " 9"));

            Load(null);
        }