Exemple #1
0
        private List <DataSourceItem> GetGraphsDataSources()
        {
            List <DataSourceItem> dataSources = new List <DataSourceItem>();

            foreach (DesignedGraph designedGraph in Graphs)
            {
                foreach (DataSourceItem dsi in designedGraph.DataSources)
                {
                    string datasourceName = dsi.GetDataSource();
                    if (datasourceName == "memory_total_kib" || datasourceName == "memory")
                    {
                        continue;
                    }

                    if (!Palette.HasCustomColour(dsi.Uuid))
                    {
                        dsi.DataSource.name_label = datasourceName;
                        dsi.ColorChanged          = true;
                        Palette.SetCustomColor(dsi.Uuid, dsi.Color);
                        dataSources.Add(dsi);
                    }
                }
            }
            if (dataSources.Count > 0)
            {
                return(dataSources);
            }

            return(null);
        }
Exemple #2
0
        private void UpdateDataSources(List <DataSourceItem> datasources)
        {
            foreach (DataSourceItem dsi in datasources)
            {
                bool found = false;
                foreach (DesignedGraph graph in Graphs)
                {
                    found = graph.DataSources.Contains(dsi);
                    if (found)
                    {
                        if (!Palette.HasCustomColour(dsi.Uuid))
                        {
                            dsi.ColorChanged = true;
                            Palette.SetCustomColor(dsi.Uuid, dsi.Color);
                        }
                        break;
                    }
                }

                if (!dsi.DataSource.standard && dsi.DataSource.name_label != "avg_cpu")
                {
                    dsi.Enabled = found;
                }
            }
        }