示例#1
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            CDO cdo = CDOHelper.CDO;

            cdo.CommunitySettings.SideMenuOpenByDefault = chkSide.Checked ? "True" : "False";
            cdo.CommunitySettings.TestServer            = txtTest.Text;
            CDOHelper.UpdateCDO(cdo);
            CDOHelper.UploadCDO();
            MessageBox.Show($" Saved");
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            string Name = comboBox1.Text;
            CDO    cdo  = CDOHelper.CDO;
            Dictionary <string, PluginSettings> plugins = cdo.CommunitySettings.Plugins;

            bool           flag     = plugins.ContainsKey(Name);
            PluginSettings settings = flag ? plugins[Name] : new PluginSettings();

            settings.Permissions.SuperAdminRun      = chkSuperAdminRun.Checked;
            settings.Permissions.TestEnvironmentRun = chkTestEnvRun.Checked;
            settings.Permissions.Everyone           = chkAllAccess.Checked;
            settings.Permissions.Personas           = cbPersonas.CheckedItems.OfType <string>().ToList();
            settings.Permissions.UserIDs            = UserIdsAccessToPlugin.Distinct().ToList();
            if (!flag)
            {
                cdo.CommunitySettings.Plugins.Add(Name, settings);
            }

            CDOHelper.UpdateCDO(cdo);
            CDOHelper.UploadCDO();
            MessageBox.Show($"{settings.PluginName} Saved");
        }