Exemplo n.º 1
0
        private void SetDefault()
        {
            XPathDocument     doc     = new XPathDocument(@"Templates\General_Template.xml");
            XPathNavigator    rootnav = doc.CreateNavigator();
            XPathNodeIterator iter    = rootnav.Select("DiagMgr/DefaultSetting/DefaultChoice");

            while (iter.MoveNext())
            {
                string            feat         = iter.Current.GetAttribute("Feature", "");
                string            ver          = iter.Current.GetAttribute("Version", "");
                bool              Profiler     = Convert.ToBoolean(iter.Current.GetAttribute("Profiler", ""));
                bool              Perfmon      = Convert.ToBoolean(iter.Current.GetAttribute("Perfmon", ""));
                bool              xevent       = Convert.ToBoolean(iter.Current.GetAttribute("XEvent", ""));
                bool              EvengLog     = Convert.ToBoolean(iter.Current.GetAttribute("EvengLog", ""));
                bool              Sqldiag      = Convert.ToBoolean(iter.Current.GetAttribute("Sqldiag", ""));
                List <string>     scenList     = new List <string>();
                XPathNodeIterator iterScenario = iter.Current.Select("Scenario");
                while (iterScenario.MoveNext())
                {
                    string scenname = iterScenario.Current.GetAttribute("name", "").ToString();
                    scenList.Add(scenname);
                }
                DefaultChoice choice = new DefaultChoice(feat, ver, Profiler, Perfmon, xevent, EvengLog, Sqldiag, scenList);
                DefaultChoiceList.Add(choice);
            }
        }
Exemplo n.º 2
0
        private void SetDefaultXeventOrProfiler()
        {
            string Feature = UserChoice[Res.Feature];
            string Version = UserChoice[Res.Version];

            DefaultChoice defaults = UserChoice.GetDefaultChoiceByFeatureVersion(Feature, Version);

            cb_CaptureXevent.Checked = defaults.Xevent;
            cb_CaptureTrace.Checked  = defaults.Profiler;
        }
Exemplo n.º 3
0
        public DefaultChoice GetDefaultChoiceByFeatureVersion(string feat, string ver)
        {
            DefaultChoice choice = DefaultChoiceList.Find(x => x.Feature == feat && x.Version == ver);

            if (null == choice)
            {
                throw new ArgumentException("Unable to find this feature and version");
            }
            return(choice);
        }