当前位置: 首页>>代码示例>>C#>>正文


C# IItem.GetLanguages方法代码示例

本文整理汇总了C#中IItem.GetLanguages方法的典型用法代码示例。如果您正苦于以下问题:C# IItem.GetLanguages方法的具体用法?C# IItem.GetLanguages怎么用?C# IItem.GetLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IItem的用法示例。


在下文中一共展示了IItem.GetLanguages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnCopyToRight_Click

        private void btnCopyToRight_Click(object sender, EventArgs e)
        {
            if (rightTreeView.SelectedNode == null)
            {
                MessageBox.Show("Select destination node in right window", "My Application", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                return;
            }

            if (leftTreeView.SelectedNode == null)
            {
                MessageBox.Show("Select source node in left window", "My Application", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                return;
            }

            /*
            IItem destItem = rightTreeView.SelectedNode.Tag as IItem;
            IItem srcItem = leftTreeView.SelectedNode.Tag as IItem;
            destItem.CopyTo(srcItem, true);
            */

            _srcItem = leftTreeView.SelectedNode.Tag as IItem;
            _destItem = rightTreeView.SelectedNode.Tag as IItem;
            _destinationNode = rightTreeView.SelectedNode;

            CopyOptions CopyOptionsForm = new CopyOptions();
            string[] sLanguages = _srcItem.GetLanguages();
            foreach (string sLang in sLanguages)
            {
                CopyOptionsForm.comboFromLanguage.Items.Add(sLang);
            }

            sLanguages = _destItem.GetLanguages();
            foreach (string sLang in sLanguages)
            {
                CopyOptionsForm.comboToLanguage.Items.Add(sLang);
            }
            CopyOptionsForm.comboToLanguage.SelectedIndex = 0;
            CopyOptionsForm.lblToPath.Text = "(" + new Uri(_destItem.GetHostUrl()).Host + ")" + _destItem.Path;

            // Setting this AFTER the destination, enables autoselect of correct destination language
            CopyOptionsForm.comboFromLanguage.SelectedIndex = 0;
            CopyOptionsForm.lblFromPath.Text = "(" + new Uri(_srcItem.GetHostUrl()).Host + ")" + _srcItem.Path;

            // Plugins
            CopyOptionsForm._itemCopyPlugins = _itemCopyPlugins;

            // Show Copyoptions
            if (CopyOptionsForm.ShowDialog(this) == DialogResult.Cancel)
                return;

            // Get copyOptions result
            _srcItem.Options.Language = CopyOptionsForm.comboFromLanguage.Text;
            _destItem.Options.Language = CopyOptionsForm.comboToLanguage.Text;
            _destItem.Options.CopyItem = CopyItem;
            if (CopyOptionsForm.rbOverwrite.Checked)
                _destItem.Options.CopyOperation = CopyOperations.Overwrite;
            else if (CopyOptionsForm.rbSkipExisting.Checked)
                _destItem.Options.CopyOperation = CopyOperations.SkipExisting;
            else if (CopyOptionsForm.rbCreateNewItemIDs.Checked)
                _destItem.Options.CopyOperation = CopyOperations.GenerateNewItemIDs;
            else if (CopyOptionsForm.rbUseNames.Checked)
                _destItem.Options.CopyOperation = CopyOperations.UseNames;
            _destItem.Options.RecursiveOperation = CopyOptionsForm.cbRecursive.Checked;

            //            _srcItem.Options.Database = CopyOptionsForm.tbFromDatabase.Text;
            //            _destItem.Options.Database = CopyOptionsForm.tbToDatabase.Text;

            // Security settings
            _srcItem.Options.CopySecuritySettings = CopyOptionsForm.cbCopySecurity.Checked;
            _destItem.Options.CopySecuritySettings = CopyOptionsForm.cbCopySecurity.Checked;
            _destItem.Options.DefaultSecurityDomain = CopyOptionsForm.tbSecurityDomain.Text;
            _destItem.Options.RootRole = CopyOptionsForm.tbRootRole.Text;
            _destItem.Options.SetItemRightsExplicitly = CopyOptionsForm.cbSetItemRightsExplicitly.Checked;

            Util.backgroundWorker.RunWorkerAsync(new BackgroundWorkerArgument("copy", null, null, this));

            _progressForm = new ProgressForm();
            _progressForm.ShowDialog(this);
        }
开发者ID:Cabana,项目名称:CMSConverter,代码行数:79,代码来源:Form1.cs


注:本文中的IItem.GetLanguages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。