示例#1
0
 public YamlStack()
 {
     var files = new ConfigGroup("files", new ConfigGroupArgs
     {
         Files = new[] { "app-*.yaml" }
     });
 }
示例#2
0
        private ToolStripMenuItem BuildMenu(ConfigGroup conGroup)
        {
            ToolStripMenuItem tsm = new ToolStripMenuItem(conGroup.Name);

            if (conGroup.Contains("Path") > -1)
            {
                tsm = BuildMenuFromPathData(com.toSystemPath(conGroup.Item("Path").Setting));
            }
            if (conGroup.Contains("cmd") > -1)
            {
                tsm.Tag    = conGroup.Item("cmd").Setting;
                tsm.Click += launch;
            }
            if (conGroup.Contains("IconResource") > -1)
            {
                if (conGroup.Item("IconResource").Setting.Contains(","))
                {
                    tsm.Image = elvDesktop.addImage(com.toSystemPath(conGroup.Item("IconResource").Setting), "");
                }
                else
                {
                    tsm.Image = com.prepareImage(com.toSystemPath(conGroup.Item("IconResource").Setting));
                }
            }
            tsm.ImageScaling = ToolStripItemImageScaling.None;
            tsm.TextAlign    = ContentAlignment.MiddleLeft;
            tsm.ImageAlign   = ContentAlignment.MiddleLeft;
            tsm.Alignment    = ToolStripItemAlignment.Left;
            tsm.Padding      = new Padding(0);
            //Debug.WriteLine(tsm.    );
            return(tsm);
        }
示例#3
0
        public static string GetCodeMap(string codeGroup, string codeName)
        {
            if (codeGroup == null || codeName == null)
            {
                return(codeName);
            }

            ConfigGroup group = GetConfigByGroup(codeGroup);

            if (group == null)
            {
                return(codeName);
            }

            var infos = group.Item;

            if (infos == null || infos.Count == 0)
            {
                return(codeName);
            }

            ConfigInfo find;

            if (infos.TryGetValue(codeName, out find))
            {
                return(find.CodeValue);
            }

            return(codeName);
        }
示例#4
0
        public static bool TryGetValue(string codeGroup, string codeName, out string codeValue)
        {
            codeValue = null;

            if (codeGroup == null || codeName == null)
            {
                return(false);
            }

            ConfigGroup group = GetConfigByGroup(codeGroup);

            if (group == null)
            {
                return(false);
            }

            var infos = group.Item;

            if (infos == null || infos.Count == 0)
            {
                return(false);
            }

            ConfigInfo find;

            if (infos.TryGetValue(codeName, out find))
            {
                codeValue = find.CodeValue;
                return(true);
            }

            return(false);
        }
 private void InitBaseChannels()
 {
     try
     {
         if (ParentItem == null)
         {
             return;
         }
         ConfigGroup configGroup = ParentItem.Data as ConfigGroup;
         if (configGroup == null)
         {
             return;
         }
         ConfigObject parentObject = configGroup.ConfigObject;
         if (parentObject == null || parentObject.ObjectType != S1110Consts.RESOURCE_SCREENSERVER)
         {
             return;
         }
         mListBaseChannels.Clear();
         for (int i = 0; i < parentObject.ListChildObjects.Count; i++)
         {
             ConfigObject configObject = parentObject.ListChildObjects[i];
             if (configObject.ObjectType == S1110Consts.RESOURCE_SCREENCHANNEL)
             {
                 mListBaseChannels.Add(configObject);
             }
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
示例#6
0
        protected ConfigBase Instantiate(ConfigBaseMetadata metadata, PluginRuntime pluginRuntime)
        {
            ServiceRegistration.Get <ILogger>().Debug("ConfigurationNode: Loading configuration item '{0}'", metadata.Location);
            ConfigBase result;

            if (metadata.GetType() == typeof(ConfigGroupMetadata))
            {
                result = new ConfigGroup();
            }
            else if (metadata.GetType() == typeof(ConfigSectionMetadata))
            {
                result = new ConfigSection();
            }
            else if (metadata.GetType() == typeof(ConfigSettingMetadata))
            {
                ConfigSettingMetadata csm = (ConfigSettingMetadata)metadata;
                try
                {
                    ConfigSetting cs = (ConfigSetting)pluginRuntime.InstantiatePluginObject(csm.ClassName);
                    if (cs == null)
                    {
                        throw new ArgumentException(string.Format("Configuration class '{0}' not found", csm.ClassName));
                    }
                    cs.Load();
                    if (csm.ListenTo != null)
                    {
                        foreach (string listenToLocation in csm.ListenTo)
                        {
                            IConfigurationNode node;
                            if (FindNode(listenToLocation, out node))
                            {
                                if (node.ConfigObj is ConfigSetting)
                                {
                                    cs.ListenTo((ConfigSetting)node.ConfigObj);
                                }
                                else
                                {
                                    ServiceRegistration.Get <ILogger>().Warn("ConfigurationNode '{0}': Trying to listen to setting, but location '{1}' references a {2}",
                                                                             Location, listenToLocation, node.ConfigObj.GetType().Name);
                                }
                            }
                        }
                    }
                    result = cs;
                }
                catch (Exception ex)
                {
                    ServiceRegistration.Get <ILogger>().Error("Error loading configuration class '{0}'", ex, csm.ClassName);
                    return(null);
                }
            }
            else
            {
                throw new NotImplementedException(string.Format("Unknown child class '{0}' of '{1}'", metadata.GetType().FullName, typeof(ConfigBaseMetadata).FullName));
            }
            result.SetMetadata(metadata);
            return(result);
        }
示例#7
0
        public static ConfigGroup LoadGroup(XmlElement xmlElement)
        {
            var configGroup = new ConfigGroup();

            configGroup.Title   = GetAttribute(xmlElement, "title", null);
            configGroup.Enabled = GetAttribute(xmlElement, "enabled", null);
            configGroup.Members = LoadMembers(xmlElement);
            return(configGroup);
        }
示例#8
0
        public static bool ComputeGroupsMapUpdate(IDictionary <string, ConfigGroup> original, IDictionary <string, ConfigGroup> updated, Dictionary <string, ConfigGroup> readSet,
                                                  Dictionary <string, ConfigGroup> writeSet, Dictionary <string, ConfigGroup> sameSet)
        {
            bool updatedMembers = false;

            foreach (string groupName in original.Keys)
            {
                ConfigGroup originalGroup = original[groupName];

                if (!updated.ContainsKey(groupName) || null == updated[groupName])
                {
                    updatedMembers = true; //missing from updated ie deleted.
                }
                else
                {
                    ConfigGroup updatedGroup = updated[groupName];

                    ConfigGroup readSetB  = new ConfigGroup();
                    ConfigGroup writeSetB = new ConfigGroup();

                    if (!ComputeGroupUpdate(originalGroup, updatedGroup, readSetB, writeSetB))
                    {
                        sameSet[groupName] = readSetB;
                    }
                    else
                    {
                        readSet[groupName]  = readSetB;
                        writeSet[groupName] = writeSetB;
                    }
                }
            }

            foreach (string groupName in updated.Keys)
            {
                ConfigGroup updatedConfigGroup = updated[groupName];

                if (!original.ContainsKey(groupName) || null == original[groupName])
                {
                    updatedMembers = true;
                    // final Configtx.ConfigGroup originalConfigGroup = original.get(groupName);
                    ConfigGroup readSetB  = new ConfigGroup();
                    ConfigGroup writeSetB = new ConfigGroup();
                    ComputeGroupUpdate(new ConfigGroup(), updatedConfigGroup, readSetB, writeSetB);
                    ConfigGroup cfg = new ConfigGroup {
                        Version = 0, ModPolicy = updatedConfigGroup.ModPolicy
                    };
                    cfg.Policies.Add(writeSetB.Policies);
                    cfg.Values.Add(writeSetB.Values);
                    cfg.Groups.Add(writeSetB.Groups);
                    writeSet[groupName] = cfg;
                }
            }

            return(updatedMembers);
        }
        private bool InitConfigData()
        {
            bool   retValue = false;
            string msg      = string.Empty;

            retValue = dbHelperOra.TestConnection(ref msg);
            Console.WriteLine("测试数据库连接状态返回的结果:{0}     错误信息:{1}", retValue ? "成功" : "失败", msg);
            retValue = false;
            try
            {
                string SectionGroupName = "LuoBei";
                configService = new ConfigService();
                xmlService    = new XmlService();
                lesseeId      = configService.getValue(SectionGroupName, "lesseeId");
                string sqlCount = configService.getValue(SectionGroupName, "excuteSqlCount");
                int.TryParse(sqlCount, out excuteSqlCount);
                string frequency = configService.getValue(SectionGroupName, "collectFrequency");
                MailReceiver = ConfigurationManager.AppSettings["MailReceiver"].ToString();
                string configUserName = configService.getValue(SectionGroupName, "UserName");
                if (string.IsNullOrEmpty(configUserName))
                {
                    UserName = SectionGroupName + UserName;
                }
                else
                {
                    UserName = configUserName;
                }

                if (frequency != "")
                {
                    int.TryParse(frequency, out nFrequency);
                }
                ConnnectionUrl    = configService.getValue(SectionGroupName, "ConnnectionUrl");
                ConnnectionGroups = configService.getValue(SectionGroupName, "ConnnectionGroups");
                isDebug           = configService.getValue(SectionGroupName, "WriteToDB").ToUpper() == "TRUE" ? false : true;

                configGroup = configService.getConfigGroup(SectionGroupName);
                xmlNodes    = configGroup.xmlNode.Split(new String[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string xmlNode in xmlNodes)
                {
                    List <ConfiguredTagData> tags = xmlService.getXmlTagConfig(configGroup.config, xmlNode);
                    foreach (var item in tags)
                    {
                        tagList.Add(item);
                    }
                }
                retValue = true;
            }
            catch (Exception ex)
            {
                Logger.Fatal("执行InitConfigData方法出错!" + ex.ToString());
            }
            return(retValue);
        }
 private void WpfConfigurator_OnSaveRequested(ConfigGroup configGroup)
 {
     try
     {
         ConfigManager.Save(configGroup);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void OpenSettings()
        {
            try
            {
                if (!Directory.Exists(this.SettingsPath))
                {
                    Directory.CreateDirectory(this.SettingsPath);
                }

                ConfigGroup settings = ConfigGroup.Create("Settings");
                if (File.Exists(this.SettingsFilePath))
                {
                    settings = ConfigGroup.Load(this.SettingsFilePath, ConfigFormat.Xml);
                }

                Screen screen = Screen.FromHandle(this.Handle);

                ConfigGroup main = settings.SetGroup("Main");
                this.Width  = main.ReadInt32("Width", this.Width);
                this.Height = main.ReadInt32("Height", this.Height);
                this.Left   = main.ReadInt32("Left", screen.WorkingArea.Width / 2 - this.Width / 2);
                this.Top    = main.ReadInt32("Top", screen.WorkingArea.Height / 2 - this.Height / 2);

                ConfigGroup last = settings.SetGroup("Last");
                m_lastTileSize      = last.ReadInt32("TileSize", 32);
                m_lastTileSetWidth  = last.ReadInt32("TileSetWidth", 10);
                m_lastTileSetHeight = last.ReadInt32("TileSetHeight", 10);
                m_lastPath          = last.ReadString("Path", null);
                m_lastDrawTileSize  = last.ReadInt32("DrawTileSize", 32);

                m_presets = new List <TilesetProperties>();

                ConfigGroup presets = settings.SetGroup("Presets");
                foreach (ConfigGroup preset in presets.Groups)
                {
                    TilesetProperties tp = new TilesetProperties();
                    tp.Width    = preset.ReadInt32("Width", 10);
                    tp.Height   = preset.ReadInt32("Height", 10);
                    tp.TileSize = preset.ReadInt32("TileSize", 32);
                    m_presets.Add(tp);
                }

                this.splitContainer1.SplitterDistance = main.ReadInt32("Splitter", splitContainer1.SplitterDistance);

                ConfigGroup misc = settings.SetGroup("Misc");
                tbbTargetRaster.Checked = misc.ReadBool("Raster", true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Die Einstellungen konnten nicht geöffnet werden.\n" + ex.Message, "Fehler",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#12
0
    public IConfigGroup Add(string groupName)
    {
        if (__configGroups.Any(x => x.GroupName.Equals(groupName, StringComparison.OrdinalIgnoreCase)))
        {
            return(__configGroups.Find(x => x.GroupName.Equals(groupName, StringComparison.OrdinalIgnoreCase)));
        }

        var group = new ConfigGroup(groupName, this);

        __configGroups.Add(group);
        Save();
        return(group);
    }
 private void WpfConfigurator_OnSaveRequested(ConfigGroup configGroup)
 {
     try
     {
         Result = ConfiguratorWindowResult.Save;
         ConfigManager.Save(configGroup);
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#14
0
        // not an api

        public static bool ComputeUpdate(string channelId, Protos.Common.Config original, Protos.Common.Config update, ConfigUpdate cupd)
        {
            ConfigGroup readSet  = new ConfigGroup();
            ConfigGroup writeSet = new ConfigGroup();

            if (ComputeGroupUpdate(original.ChannelGroup, update.ChannelGroup, readSet, writeSet))
            {
                cupd.ReadSet   = readSet;
                cupd.WriteSet  = writeSet;
                cupd.ChannelId = channelId;
                return(true);
            }
            return(false);
        }
示例#15
0
 private void RaiseSaveRequested(ConfigGroup configGroup)
 {
     try
     {
         if (SaveRequested != null && configGroup != null)
         {
             SaveRequested(configGroup);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        public static void Save(ConfigGroup configGroup)
        {
            try
            {
                var json = JsonConvert.SerializeObject(configGroup, Formatting.Indented, new SecureStringSerializer());
                File.WriteAllText(Path.Combine(WorkingDirectory, configGroup.DisplayName + ".config"), json);

                // Mark as initialized after saving
                configGroup.IsInitialized = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
示例#17
0
        internal static void AddItem(this ConfigGroup group, Config item)
        {
            string key = item.CODE_NAME;

            if (key == null)
            {
                return;
            }

            ConfigInfo info;

            if (group.Item.TryGetValue(key, out info) == false)
            {
                info = CreateHelper.CreateConfigInfo(item);
                group.Item.Add(key, info);
            }
        }
示例#18
0
        internal static ConfigGroup SafeGetConfigGorup(string name)
        {
            string key = name ?? "";

            ConfigGroup group;

            if (Data.TryGetValue(key, out group) == false)
            {
                group           = new ConfigGroup();
                group.CodeGroup = key;
                group.Item      = new Dictionary <string, ConfigInfo>();

                Data.Add(key, group);
            }

            return(group);
        }
        private void SaveSettings()
        {
            try
            {
                if (!Directory.Exists(this.SettingsPath))
                {
                    Directory.CreateDirectory(this.SettingsPath);
                }

                ConfigGroup settings = ConfigGroup.Create("Settings");

                ConfigGroup main = settings.SetGroup("Main");
                main.Write("Left", this.Left);
                main.Write("Top", this.Top);
                main.Write("Width", this.Width);
                main.Write("Height", this.Height);
                main.Write("Splitter", this.splitContainer1.SplitterDistance);

                ConfigGroup last = settings.SetGroup("Last");
                last.Write("TileSize", m_lastTileSize);
                last.Write("TileSetWidth", m_lastTileSetWidth);
                last.Write("TileSetHeight", m_lastTileSetHeight);
                last.Write("Path", m_lastPath ?? string.Empty);
                last.Write("DrawTileSize", m_lastDrawTileSize);

                ConfigGroup presets = settings.SetGroup("Presets");
                for (int i = 0; i < m_presets.Count; i++)
                {
                    ConfigGroup preset = presets.SetGroup("Preset" + (1 + i));
                    preset.Write("Width", m_presets[i].Width);
                    preset.Write("Height", m_presets[i].Height);
                    preset.Write("TileSize", m_presets[i].TileSize);
                }

                ConfigGroup misc = settings.SetGroup("Misc");
                misc.Write("Raster", tbbTargetRaster.Checked);

                settings.Save(this.SettingsFilePath, ConfigFormat.Xml);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Die Einstellungen konnten nicht gespeichert werden.\n" + ex.Message, "Fehler",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        void ButnNext_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckInputNumber())
            {
                return;
            }
            //新建机器
            List <ObjectItem> tempObjItem = WizardHelper.ListAllObjectItem.Where(p => p.Type == 1).ToList();
            int ReadyMachineNumber        = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 210).ToList().Count();
            int j = 0;

            for (; j < tempObjItem.Count; j++)
            {
                ConfigGroup tempCG = tempObjItem[j].Data as ConfigGroup;
                if (tempCG.GroupID == 1 && tempCG.ChildType == 210)
                {
                    int MinValue = tempCG.GroupInfo.IntValue01; int MaxValue = tempCG.GroupInfo.IntValue02;
                    if ((ReadyMachineNumber + TotalMachineNumber) > MaxValue || (ReadyMachineNumber + TotalMachineNumber) < MinValue)
                    {
                        CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("1110N008", "超过个数,不能增加"));
                        return;
                    }
                    for (int i = 0; i < TotalMachineNumber; i++)
                    {
                        //ListConfigObject.Add(WizardHelper.CreateNewConfigObject(tempCG.ConfigObject, 210));
                        ListConfigObject.Add(tempCG.ConfigObject);
                    }
                    break;
                }
            }
            //进入下一个配置界面
            UCWizardMachineConfig ucwizard = new UCWizardMachineConfig();

            ucwizard.CurrentApp            = CurrentApp;
            ucwizard.MainPage              = MainPage;
            ucwizard.PrePage               = this;
            ucwizard.TotalMachineNumber    = TotalMachineNumber;
            ucwizard.mListSaveConfigObject = ListConfigObject;
            ucwizard.WizardHelper          = this.WizardHelper;
            //ucwizard.ListConfigObjects = ListConfigObjects;
            MainPage.PopupPanel.Title   = "Config Wizard";
            MainPage.PopupPanel.Content = ucwizard;
            MainPage.PopupPanel.IsOpen  = true;
        }
示例#21
0
文件: Program.cs 项目: stever/windar
        Program()
        {
            Instance = this;

            Config = new ConfigGroup();
            Paths = new WindarPaths(Application.StartupPath);
            Daemon = new DaemonController(Paths);
            ScanQueue = new Queue<string>();
            MainForm = new MainForm();
            Tray = new Tray();
            PluginHost = new PluginHost(Paths);
            WaitingDialog = new WaitingDialog();

            // Register command event handlers.
            Daemon.ScanCompleted += ScanCompleted;
            Daemon.PlaydarStopped += PlaydarStopped;
            Daemon.PlaydarStarted += PlaydarStarted;
            Daemon.PlaydarStartFailed += PlaydarStartFailed;
        }
示例#22
0
        private void Init()//在保存前生成243
        {
            //生成243的ConfigObject对象,之前要检查是否已经建立了这个类型的CTI对象
            List <ConfigObject> TempReadyCTI = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 243).ToList();
            var PageValue = this.ComCTIType.SelectedItem; bool IsFind = false;

            if (PageValue != null)
            {
                string pValue = (PageValue as PropertyValueEnumItem).Value;
                for (int i = 0; i < TempReadyCTI.Count; i++)
                {
                    string properValueofList = TempReadyCTI[i].ListProperties.FirstOrDefault(p => p.PropertyID == 11).Value;
                    if (properValueofList == pValue)
                    {
                        IsFind          = true;
                        CTIConfigObject = TempReadyCTI[i];
                        break;
                    }
                }
            }
            List <ObjectItem> tempObjItem = WizardHelper.ListAllObjectItem.Where(p => p.Type == 1).ToList();
            //int ReadyNumber = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 243).ToList().Count();
            int j = 0; ConfigGroup tempCG = new ConfigGroup();

            for (; j < tempObjItem.Count; j++)
            {
                tempCG = tempObjItem[j].Data as ConfigGroup;
                if (tempCG.GroupID == 51 && tempCG.ChildType == 243 && tempCG.TypeID == 0)
                {
                    CTIObjItem = tempObjItem[j];
                    //int MinValue = tempCG.GroupInfo.IntValue01; int MaxValue = tempCG.GroupInfo.IntValue02;
                    //if ((ReadyNumber + 1) > MaxValue || (ReadyNumber + 1) < MinValue)
                    //{ return; }
                    //CTIConfigObject = WizardHelper.CreateNewConfigObject(tempCG.ConfigObject, 243);
                    break;
                }
            }
            if (!IsFind)
            {
                CTIConfigObject = WizardHelper.CreateNewConfigObject(tempCG.ConfigObject, 243);
            }
        }
示例#23
0
 private void Init()
 {
     try
     {
         if (ParentItem == null)
         {
             return;
         }
         ConfigGroup parentGroup = ParentItem.Data as ConfigGroup;
         if (parentGroup == null)
         {
             return;
         }
         ConfigObject parentObject = parentGroup.ConfigObject;
         mParentObject = parentObject;
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
示例#24
0
        protected ConfigBase Instantiate(ConfigBaseMetadata metadata, PluginRuntime pluginRuntime)
        {
            ServiceRegistration.Get <ILogger>().Debug("ConfigurationNode: Loading configuration item '{0}'", metadata.Location);
            ConfigBase result;

            if (metadata.GetType() == typeof(ConfigGroupMetadata))
            {
                result = new ConfigGroup();
            }
            else if (metadata.GetType() == typeof(ConfigSectionMetadata))
            {
                result = new ConfigSection();
            }
            else if (metadata.GetType() == typeof(ConfigSettingMetadata))
            {
                ConfigSettingMetadata csm = (ConfigSettingMetadata)metadata;
                try
                {
                    ConfigSetting cs = (ConfigSetting)pluginRuntime.InstantiatePluginObject(csm.ClassName);
                    if (cs == null)
                    {
                        throw new ArgumentException(string.Format("Configuration class '{0}' not found", csm.ClassName));
                    }
                    cs.Load();
                    result = cs;
                }
                catch (Exception ex)
                {
                    ServiceRegistration.Get <ILogger>().Error("Error loading configuration class '{0}'", ex, csm.ClassName);
                    return(null);
                }
            }
            else
            {
                throw new NotImplementedException(string.Format("Unknown child class '{0}' of '{1}'", metadata.GetType().FullName, typeof(ConfigBaseMetadata).FullName));
            }
            result.SetMetadata(metadata);
            return(result);
        }
示例#25
0
 private void InitControlObject()
 {
     ListConcurrencies = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 224 && p.ParentID == RecordConfigObj.ObjectID).ToList();
     //if (RecordAgreementNumber == 1)
     //{
     //    RecordAgreementNumber = ListAgreements.Count();
     //}
     int ListCount = ListConcurrencies.Count;
     List<BasicInfoData> TempBasicInfo = WizardHelper.ListAllBasicInfos.Where(p => p.InfoID == 111000150).ToList();
     foreach (BasicInfoData info in TempBasicInfo)
     {
         PropertyValueEnumItem propertyValueItem = new PropertyValueEnumItem();
         propertyValueItem.IsCheckedChanged += EnumItem_IsCheckedChanged;
         propertyValueItem.Value = info.Value;
         propertyValueItem.Display =
             CurrentApp.GetLanguageInfo(string.Format("BID{0}{1}", info.InfoID, info.SortID.ToString("000")),
                 info.Icon);
         propertyValueItem.Info = info;
         ListConcurrencyItems.Add(propertyValueItem);
     }
     this.TexLicenseNumber.Text = "0";
     if (ListCount >= RecordConcurrencyNumber)
     {
         //加载显示已有项
         CurrentConfigObj = ListConcurrencies[RecordConcurrencyNumber - 1];
         ResourceProperty NetworkName = CurrentConfigObj.ListProperties.FirstOrDefault(p => p.PropertyID == 12);
         if (NetworkName != null)
         {
             this.TexLicenseNumber.Text = NetworkName.Value;
         }
         ResourceProperty mPropertyValue = CurrentConfigObj.ListProperties.Find(p => p.PropertyID == 11);
         if (mPropertyValue != null)
         {
             int value = 0;
             if (int.TryParse(mPropertyValue.Value, out value))
             {
                 for (int i = 0; i < ListConcurrencyItems.Count; i++)
                 {
                     if (ListConcurrencyItems[i].Value == value.ToString())
                     {
                         this.CombNumber.SelectedIndex = i;
                     }
                 }
             }
         }
     }
     else
     {
         List<ObjectItem> tempObjItem = WizardHelper.ListAllObjectItem.Where(p => p.Type == 1).ToList();
         int ReadyNumber = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 224 && p.ParentID == RecordConfigObj.ObjectID).ToList().Count();
         for (int i = 0; i < tempObjItem.Count; i++)
         {
             ConfigGroup tempCG = tempObjItem[i].Data as ConfigGroup;
             if (tempCG.GroupID == 28 && tempCG.ChildType == 224 && tempCG.ConfigObject == RecordConfigObj)
             {
                 int MinValue = tempCG.GroupInfo.IntValue01; int MaxValue = tempCG.GroupInfo.IntValue02;
                 if ((ReadyNumber + 1) > MaxValue || (ReadyNumber + 1) < MinValue)
                 { return; }
                 //WizardHelper.ListAllConfigObjects.Add(WizardHelper.CreateNewConfigObject(tempCG.ConfigObject, 222));
                 CurrentConfigObj = WizardHelper.CreateNewConfigObject(tempCG.ConfigObject, 224);
                 CurrentConfigObj.CurrentApp = CurrentApp;
                 CurrentConfigObj.ListProperties.Find(p => p.PropertyID == 3).Value = RecordConfigObj.ObjectID.ToString();
                 ParentObjectItem = tempObjItem[i];
                 break;
             }
         }
     }
 }
        private void InitControlObject()
        {
            //加载下载方式下拉项
            List <BasicInfoData> TempBasicInfo = WizardHelper.ListAllBasicInfos.Where(p => p.InfoID == 111000115).ToList();

            mListDownWayItems.Clear();
            foreach (BasicInfoData info in TempBasicInfo)
            {
                PropertyValueEnumItem propertyValueItem = new PropertyValueEnumItem();
                propertyValueItem.Value   = info.Value;
                propertyValueItem.Display =
                    CurrentApp.GetLanguageInfo(string.Format("BID{0}{1}", info.InfoID, info.SortID.ToString("000")),
                                               info.Icon);
                propertyValueItem.Info = info;
                mListDownWayItems.Add(propertyValueItem);
            }
            //加载录音服务器下拉项
            List <ConfigObject> TempConfigObj = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 221).ToList();

            mListVoiceServiceItems.Clear();
            foreach (ConfigObject Obj in TempConfigObj)
            {
                PropertyValueEnumItem propertyValue = new PropertyValueEnumItem();
                propertyValue.Value   = Obj.ObjectID.ToString();
                propertyValue.Display = Obj.ToString();
                propertyValue.Info    = Obj;
                mListVoiceServiceItems.Add(propertyValue);
            }

            //生成291的ConfigObject对象
            if (DownLoadNumber > mListDownConfigObjs.Count)
            {
                //加载默认值
                this.IPTextBox.SetIP("127.0.0.1");
                this.TexPort.Text        = "";
                this.TexCatalog.Text     = "";
                this.TexLoginName.Text   = "";
                this.PasswLogin.Password = "";

                List <ObjectItem> tempObjItem = WizardHelper.ListAllObjectItem.Where(p => p.Type == 1).ToList();
                int j = 0;
                for (; j < tempObjItem.Count; j++)
                {
                    ConfigGroup tempCG = tempObjItem[j].Data as ConfigGroup;
                    if (tempCG.GroupID == 9 && tempCG.ChildType == 291)
                    {
                        DownloadObjectItem  = tempObjItem[j];
                        CurrentConfigObject = WizardHelper.CreateNewConfigObject(tempCG.ConfigObject, 291);
                        mListDownConfigObjs.Add(CurrentConfigObject);
                        break;
                    }
                }
            }
            else
            {
                CurrentConfigObject = mListDownConfigObjs[DownLoadNumber - 1];
            }
            for (int i = 0; i < CurrentConfigObject.ListProperties.Count; i++)
            {
                int    propertyID    = CurrentConfigObject.ListProperties[i].PropertyID;
                string propertyValue = CurrentConfigObject.ListProperties[i].Value;
                if (propertyValue == null || propertyValue == string.Empty)
                {
                    continue;
                }
                switch (propertyID)
                {
                case 11:
                    for (int k = 0; k < mListDownWayItems.Count; k++)
                    {
                        if (mListDownWayItems[k].Value == propertyValue)
                        {
                            this.CombDownWay.SelectedItem = mListDownWayItems[k]; break;
                        }
                    }
                    break;

                case 12:
                    for (int k = 0; k < mListVoiceServiceItems.Count; k++)
                    {
                        if (mListVoiceServiceItems[k].Value == propertyValue)
                        {
                            this.CombVoice.SelectedItem = mListVoiceServiceItems[k]; break;
                        }
                    }
                    break;

                case 13:
                    this.IPTextBox.SetIP(propertyValue);
                    break;

                case 14:
                    this.TexPort.Text = propertyValue;
                    break;

                case 15:
                    this.TexCatalog.Text = propertyValue;
                    break;

                case 911:
                    this.TexLoginName.Text = propertyValue;
                    break;

                case 912:
                    this.PasswLogin.Password = propertyValue;
                    break;
                }
            }
        }
示例#27
0
 public void AddConfigGroup(ConfigGroup group)
 {
     Db.ConfigGroup.AddObject(group);
 }
        private void Init()
        {
            try
            {
                LvResourceObjects.ItemsSource = mListConfigObjects;
                mViewID = string.Format("1110010");

                if (ObjectItem == null)
                {
                    return;
                }
                ConfigGroup configGroup = ObjectItem.Data as ConfigGroup;
                if (configGroup == null)
                {
                    return;
                }
                if (configGroup.GroupType != ResourceGroupType.ChildList)
                {
                    return;
                }
                mParentObject = configGroup.ConfigObject;
                mObjectType   = configGroup.ChildType;
                if (mObjectType > 0)
                {
                    switch (mObjectType)
                    {
                    case S1110Consts.RESOURCE_MACHINE:
                        mViewID = string.Format("1110210");
                        break;

                    case S1110Consts.RESOURCE_LICENSESERVER:
                    case S1110Consts.RESOURCE_DATATRANSFERSERVER:
                    case S1110Consts.RESOURCE_CTIHUBSERVER:
                    case S1110Consts.RESOURCE_DBBRIDGE:
                    case S1110Consts.RESOURCE_ALARMMONITOR:
                    case S1110Consts.RESOURCE_ALARMSERVER:
                    case S1110Consts.RESOURCE_SFTP:
                    case S1110Consts.RESOURCE_VOICESERVER:
                    case S1110Consts.RESOURCE_SCREENSERVER:
                    case S1110Consts.RESOURCE_ISASERVER:
                    case S1110Consts.RESOURCE_CMSERVER:
                    case S1110Consts.RESOURCE_KEYGENERATOR:
                    case S1110Consts.RESOURCE_FILEOPERATOR:
                    case S1110Consts.RESOURCE_SPEECHANALYSISPARAM:
                        mViewID = string.Format("1110011");
                        break;

                    case S1110Consts.RESOURCE_STORAGEDEVICE:
                        mViewID = string.Format("1110214");
                        break;

                    case S1110Consts.RESOURCE_PBXDEVICE:
                        mViewID = string.Format("1110220");
                        break;

                    case S1110Consts.RESOURCE_CHANNEL:
                        mViewID = string.Format("1110225");
                        break;

                    case S1110Consts.RESOURCE_SCREENCHANNEL:
                        mViewID = string.Format("1110012");
                        break;

                    case S1110Consts.RESOURCE_DOWNLOADPARAM:
                        mViewID = string.Format("1110291");
                        break;
                    }
                }

                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (s, de) =>
                {
                    LoadViewColumnItems();
                };
                worker.RunWorkerCompleted += (s, re) =>
                {
                    worker.Dispose();

                    InitResourceObjects();
                    CreateColumnsItems();
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
示例#29
0
        private static bool ComputeGroupUpdate(ConfigGroup original, ConfigGroup updated, ConfigGroup readSet, ConfigGroup writeSet)
        {
            Dictionary <string, ConfigPolicy> readSetPolicies  = new Dictionary <string, ConfigPolicy>();
            Dictionary <string, ConfigPolicy> writeSetPolicies = new Dictionary <string, ConfigPolicy>();
            Dictionary <string, ConfigPolicy> sameSetPolicies  = new Dictionary <string, ConfigPolicy>();

            bool policiesMembersUpdated = ComputePoliciesMapUpdate(original.Policies, updated.Policies, writeSetPolicies, sameSetPolicies);

            Dictionary <string, ConfigValue> readSetValues  = new Dictionary <string, ConfigValue>();
            Dictionary <string, ConfigValue> writeSetValues = new Dictionary <string, ConfigValue>();
            Dictionary <string, ConfigValue> sameSetValues  = new Dictionary <string, ConfigValue>();

            bool valuesMembersUpdated = ComputeValuesMapUpdate(original.Values, updated.Values, writeSetValues, sameSetValues);

            Dictionary <string, ConfigGroup> readSetGroups  = new Dictionary <string, ConfigGroup>();
            Dictionary <string, ConfigGroup> writeSetGroups = new Dictionary <string, ConfigGroup>();
            Dictionary <string, ConfigGroup> sameSetGroups  = new Dictionary <string, ConfigGroup>();

            bool groupsMembersUpdated = ComputeGroupsMapUpdate(original.Groups, updated.Groups, readSetGroups, writeSetGroups, sameSetGroups);

            if (!policiesMembersUpdated && !valuesMembersUpdated && !groupsMembersUpdated && original.ModPolicy.Equals(updated.ModPolicy))
            {
                // nothing changed.

                if (writeSetValues.Count == 0 && writeSetPolicies.Count == 0 && writeSetGroups.Count == 0 && readSetGroups.Count == 0)
                {
                    readSet.Version  = original.Version;
                    writeSet.Version = original.Version;
                    return(false);
                }
                readSet.Version = original.Version;
                readSet.Groups.Add(readSetGroups);
                writeSet.Version = original.Version;
                writeSet.Policies.Add(writeSetPolicies);
                writeSet.Values.Add(writeSetValues);
                writeSet.Groups.Add(writeSetGroups);
                return(true);
            }
            foreach (string name in sameSetPolicies.Keys)
            {
                readSetPolicies[name]  = sameSetPolicies[name];
                writeSetPolicies[name] = sameSetPolicies[name];
            }
            foreach (string name in sameSetValues.Keys)
            {
                readSetValues[name]  = sameSetValues[name];
                writeSetValues[name] = sameSetValues[name];
            }
            foreach (string name in sameSetGroups.Keys)
            {
                readSetGroups[name]  = sameSetGroups[name];
                writeSetGroups[name] = sameSetGroups[name];
            }

            readSet.Version = original.Version;
            readSet.Policies.Add(readSetPolicies);
            readSet.Values.Add(readSetValues);
            readSet.Groups.Add(readSetGroups);
            writeSet.Version = original.Version + 1;
            writeSet.Policies.Add(writeSetPolicies);
            writeSet.Values.Add(writeSetValues);
            writeSet.ModPolicy = updated.ModPolicy;
            writeSet.Groups.Add(writeSetGroups);
            return(true);
        }
示例#30
0
        private void InitControlObject()
        {
            ListRecordNetwork = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 222 && p.ParentID == RecordConfigObj.ObjectID).ToList();
            int ListCount = ListRecordNetwork.Count;
            List <BasicInfoData> TempBasicInfo = WizardHelper.ListAllBasicInfos.Where(p => p.InfoID == 111000200).ToList();

            foreach (BasicInfoData info in TempBasicInfo)
            {
                PropertyValueEnumItem propertyValueItem = new PropertyValueEnumItem();
                propertyValueItem.IsCheckedChanged += EnumItem_IsCheckedChanged;
                propertyValueItem.Value             = info.Value;
                propertyValueItem.Display           =
                    CurrentApp.GetLanguageInfo(string.Format("BID{0}{1}", info.InfoID, info.SortID.ToString("000")),
                                               info.Icon);
                propertyValueItem.Info = info;
                ListCaptureItems.Add(propertyValueItem);
            }
            if (ListCount >= RecordNetWorkNumber)
            {
                //加载显示已有项
                NetworkConfigObj = ListRecordNetwork[RecordNetWorkNumber - 1];
                ResourceProperty NetworkName = NetworkConfigObj.ListProperties.FirstOrDefault(p => p.PropertyID == 12);
                if (NetworkName != null)
                {
                    this.CombNetworkName.Text = NetworkName.Value;
                }
                ResourceProperty mPropertyValue = NetworkConfigObj.ListProperties.Find(p => p.PropertyID == 11);
                if (mPropertyValue != null)
                {
                    int value = 0;
                    if (int.TryParse(mPropertyValue.Value, out value))
                    {
                        if ((value & 1) == 1)
                        {
                            PropertyValueEnumItem propertyItem = ListCaptureItems.FirstOrDefault(p => p.Value == "1");
                            if (propertyItem != null)
                            {
                                propertyItem.IsChecked = true;
                            }
                            else
                            {
                                propertyItem.IsChecked = false;
                            }
                        }
                        if ((value & 2) == 2)
                        {
                            PropertyValueEnumItem propertyItem = ListCaptureItems.FirstOrDefault(p => p.Value == "2");
                            if (propertyItem != null)
                            {
                                propertyItem.IsChecked = true;
                            }
                            else
                            {
                                propertyItem.IsChecked = false;
                            }
                        }
                    }
                }
            }
            else
            {
                List <ObjectItem> tempObjItem = WizardHelper.ListAllObjectItem.Where(p => p.Type == 1).ToList();
                int ReadyNumber = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 222 && p.ParentID == RecordConfigObj.ObjectID).ToList().Count();
                for (int i = 0; i < tempObjItem.Count; i++)
                {
                    ConfigGroup tempCG = tempObjItem[i].Data as ConfigGroup;
                    if (tempCG.GroupID == 26 && tempCG.ChildType == 222 && tempCG.ConfigObject == RecordConfigObj)
                    {
                        int MinValue = tempCG.GroupInfo.IntValue01; int MaxValue = tempCG.GroupInfo.IntValue02;
                        if ((ReadyNumber + 1) > MaxValue || (ReadyNumber + 1) < MinValue)
                        {
                            return;
                        }
                        //WizardHelper.ListAllConfigObjects.Add(WizardHelper.CreateNewConfigObject(tempCG.ConfigObject, 222));
                        NetworkConfigObj = WizardHelper.CreateNewConfigObject(tempCG.ConfigObject, 222);
                        NetworkConfigObj.ListProperties.Find(p => p.PropertyID == 3).Value = RecordConfigObj.ObjectID.ToString();
                        ParentObjectItem = tempObjItem[i];
                        break;
                    }
                }
            }
        }
示例#31
0
        private void InitControlObject()
        {
            ListScreenConfigObjs = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 232 && p.ParentID == ScreenSeviceConfigObj.ObjectID).ToList();
            //if (RecordAgreementNumber == 1)
            //{
            //    RecordAgreementNumber = ListAgreements.Count();
            //}
            int ListCount = ListScreenConfigObjs.Count;
            List <BasicInfoData> TempBasicInfo = WizardHelper.ListAllBasicInfos.Where(p => p.InfoID == 111000165).ToList();

            ListScreenStartupModeItems.Clear();
            foreach (BasicInfoData info in TempBasicInfo)
            {
                PropertyValueEnumItem propertyValueItem = new PropertyValueEnumItem();
                propertyValueItem.IsCheckedChanged += EnumItem_IsCheckedChanged;
                propertyValueItem.Value             = info.Value;
                propertyValueItem.Display           =
                    CurrentApp.GetLanguageInfo(string.Format("BID{0}{1}", info.InfoID, info.SortID.ToString("000")),
                                               info.Icon);
                propertyValueItem.Info = info;
                ListScreenStartupModeItems.Add(propertyValueItem);
            }
            List <BasicInfoData> TempBasicInfoStop = WizardHelper.ListAllBasicInfos.Where(p => p.InfoID == 111000166).ToList();

            ListScreenStopModeItems.Clear();
            foreach (BasicInfoData info in TempBasicInfoStop)
            {
                PropertyValueEnumItem propertyValueItem = new PropertyValueEnumItem();
                propertyValueItem.IsCheckedChanged += StopEnumItem_IsCheckedChanged;
                propertyValueItem.Value             = info.Value;
                propertyValueItem.Display           =
                    CurrentApp.GetLanguageInfo(string.Format("BID{0}{1}", info.InfoID, info.SortID.ToString("000")),
                                               info.Icon);
                propertyValueItem.Info = info;
                ListScreenStopModeItems.Add(propertyValueItem);
            }
            if (ListCount >= ScreenChanNumber)
            {
                //加载显示已有项
                CurrentConfigObj = ListScreenConfigObjs[ScreenChanNumber - 1];
                ResourceProperty ExtName = CurrentConfigObj.ListProperties.FirstOrDefault(p => p.PropertyID == 12);
                if (ExtName != null)
                {
                    this.TexExtName.Text = ExtName.Value;
                }
                ResourceProperty mPropertyValue = CurrentConfigObj.ListProperties.Find(p => p.PropertyID == 15);
                if (mPropertyValue != null)
                {
                    int value = 0;
                    if (int.TryParse(mPropertyValue.Value, out value))
                    {
                        for (int i = 0; i < ListScreenStartupModeItems.Count; i++)
                        {
                            if (ListScreenStartupModeItems[i].Value == value.ToString())
                            {
                                this.CombStartup.SelectedIndex = i;
                            }
                        }
                    }
                }
                ResourceProperty mStopPropertyValue = CurrentConfigObj.ListProperties.Find(p => p.PropertyID == 16);
                if (mStopPropertyValue != null)
                {
                    int value = 0;
                    if (int.TryParse(mStopPropertyValue.Value, out value))
                    {
                        for (int i = 0; i < ListScreenStopModeItems.Count; i++)
                        {
                            if (ListScreenStopModeItems[i].Value == value.ToString())
                            {
                                this.CombStop.SelectedIndex = i;
                            }
                        }
                    }
                }
            }
            else
            {
                List <ObjectItem> tempObjItem = WizardHelper.ListAllObjectItem.Where(p => p.Type == 1).ToList();
                int ReadyNumber = WizardHelper.ListAllConfigObjects.Where(p => p.ObjectType == 232 && p.ParentID == ScreenSeviceConfigObj.ObjectID).ToList().Count();
                for (int i = 0; i < tempObjItem.Count; i++)
                {
                    ConfigGroup tempCG = tempObjItem[i].Data as ConfigGroup;
                    if (tempCG.GroupID == 1 && tempCG.ChildType == 232 && tempCG.ConfigObject == ScreenSeviceConfigObj)
                    {
                        int MinValue = tempCG.GroupInfo.IntValue01; int MaxValue = tempCG.GroupInfo.IntValue02;
                        if ((ReadyNumber + 1) > MaxValue || (ReadyNumber + 1) < MinValue)
                        {
                            return;
                        }
                        CurrentConfigObj = WizardHelper.CreateNewConfigObject(tempCG.ConfigObject, 232);
                        CurrentConfigObj.ListProperties.Find(p => p.PropertyID == 3).Value = ScreenSeviceConfigObj.ObjectID.ToString();
                        ParentObjectItem = tempObjItem[i];
                        break;
                    }
                }
            }
        }