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


C# Document.Clear方法代码示例

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


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

示例1: Import

        public override Document Import()
        {
            var toret = new Document();
            Question q = null;
            string line;

            toret.Clear();
            line = this.ReadLine();
            while ( line != null ) {
                line = line.Trim();

                if ( line.Length > 0 ) {
                    if ( IsQuestion( ref line ) ) {
                        if ( q != null ) {
                            toret.Add( q );
                        }

                        q = new Question( line );
                        q.ClearAnswers();
                    }
                    else
                    if ( IsAnswer( ref line ) ) {
                        q.AddAnswer( line );
                    }
                }

                line = this.ReadLine();
            }

            if ( q != null ) {
                toret.Add( q );
            }

            return toret;
        }
开发者ID:Baltasarq,项目名称:Testy,代码行数:35,代码来源:TextImporter.cs

示例2: Import

        /// <summary>
        /// Creates a new document, loading its contents from a XML file.
        /// </summary>
        public override Document Import()
        {
            var toret = new Document();

            toret.Clear();

            // Load the xml document
            var doc = new XmlDocument();
            doc.Load( this.FileName );

            // Read all questions
            XmlNodeList qlist = doc.GetElementsByTagName( XmlLblQuestion );
            foreach(XmlElement qnode in qlist)
            {
                var q = new Question();
                q.ClearAnswers();
                XmlNodeList answerList = qnode.GetElementsByTagName( XmlLblAnswer );
                XmlNodeList textList = qnode.GetElementsByTagName( XmlLblText );

                // Get text
                if ( textList.Count == 1 ) {
                    q.Text = textList[ 0 ].InnerText;
                } else {
                    throw new XmlException( "nonsense: more than one text label" );
                }

                // Get answers
                int numAnswer = 0;
                foreach(XmlElement answerNode in answerList) {
                    XmlAttribute correct = answerNode.GetAttributeNode( XmlLblCorrect );

                    if ( correct != null )
                    {
                        // Store new answer
                        q.AddAnswer( answerNode.InnerText );
                        if ( Convert.ToInt32( correct.Value ) > 0 ) {
                            q.CorrectAnswer = numAnswer;
                        }
                    } else {
                        throw new XmlException( "missing attributes in answer" );
                    }

                    ++numAnswer;
                }

                // Store question
                toret.Add( q );
            }

            return toret;
        }
开发者ID:Baltasarq,项目名称:Testy,代码行数:54,代码来源:XmlImporter.cs

示例3: LoadMessage

        /// <summary>
        /// 显示分页后的系统消息
        /// </summary>
        /// <param name="e"></param>
        private void LoadMessage(TreeNode e)
        {
            RTBRecord.Clear();
            RTBRecord.ClearUndo();

            OleDbDataReader dr = OleDb.ExSQLReDr("SELECT * FROM (SELECT TOP " + PageSize + " * FROM (SELECT * FROM (SELECT TOP " + PageSize * int.Parse(txt_pageIndex.Text.ToString()) + " * FROM MessageLog where MessageType='" + e.Tag.ToString() + "' and Belong='" + XmppConn.MyJID.Bare.ToString() + "') ORDER BY id desc) ) ORDER BY ID asc");
            //OleDbDataReader dr = OleDb.ExSQLReDr("SELECT TOP " + PageSize + " * FROM (SELECT TOP " + PageSize * int.Parse(txt_pageIndex.Text.ToString()) + " * FROM MessageLog where MessageType='" + e.Tag.ToString() + "' ORDER BY id DESC) ORDER BY id");
            //OleDbDataReader dr = OleDb.ExSQLReDr("select * from MessageLog where MessageType='" + e.Tag.ToString() + "' order by [ID] asc");
            while (dr.Read())
            {
                Document document = new Document();
                string sytsem_msg = "<message xmlns=\"jabber:client\" from=\"[email protected]\" to=\"[email protected]\"><FName>宋体</FName><FSize>9</FSize><FBold>true</FBold><FItalic>false</FItalic><FStrikeout>false</FStrikeout><FUnderline>true</FUnderline><CA>207</CA><CR>119</CR><CG>33</CG><CB>255</CB><body>[系统通知]    " + dr.GetDateTime(4).ToString("yyyy-MM-dd HH:mm:ss") + "</body></message>";
                document.LoadXml(sytsem_msg);
                CSS.IM.XMPP.protocol.client.Message top_msg = (CSS.IM.XMPP.protocol.client.Message)document.RootElement;
                RTBRecord_Show(top_msg, false);

                document.Clear();
                document.LoadXml(dr.GetString(3));
                top_msg = (CSS.IM.XMPP.protocol.client.Message)document.RootElement;
                top_msg.Body = top_msg.Body + "\n";

                MqMessage mqMsg=MessageBoxForm.MarkMessage_Mq(top_msg);
                if (top_msg.GetTag("subject")!=null)
                {
                    top_msg.Body = mqMsg.Herf + "?token=" + mqMsg.Token + "&url=" + mqMsg.Url + "&password=" + Base64.EncodeBase64(XmppConn.Password);
                }
                RTBRecord_Show(top_msg, false);
            }
        }
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:33,代码来源:MessageLogForm.cs

示例4: Document

        private void 关闭声音ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Document doc = new Document();
            doc.LoadFile(CSS.IM.UI.Util.Path.ConfigFilename);
            Settings.Settings config = new Settings.Settings();
            Settings.Paths path = doc.RootElement.SelectSingleElement(typeof(Settings.Paths)) as Settings.Paths;

            if (关闭声音ToolStripMenuItem.Text == "关闭所有声音")
            {
                关闭声音ToolStripMenuItem.Text = "开启所有声音";
                path.SelectSingleElement("MsgPath").SetAttribute("Enable", false);
                CSS.IM.UI.Util.Path.MsgSwitch = false;
                path.SelectSingleElement("SystemPath").SetAttribute("Enable", false);
                CSS.IM.UI.Util.Path.SystemSwitch = false;
                path.SelectSingleElement("CallPath").SetAttribute("Enable", false);
                CSS.IM.UI.Util.Path.CallSwitch = false;
                path.SelectSingleElement("FolderPath").SetAttribute("Enable", false);
                CSS.IM.UI.Util.Path.FolderSwitch = false;
                path.SelectSingleElement("GlobalPath").SetAttribute("Enable", false);
                CSS.IM.UI.Util.Path.GlobalSwitch = false;
                path.SelectSingleElement("InputAlertPath").SetAttribute("Enable", false);
                CSS.IM.UI.Util.Path.InputAlertSwitch = false;
            }
            else
            {
                关闭声音ToolStripMenuItem.Text = "开启所有声音";
                path.SelectSingleElement("MsgPath").SetAttribute("Enable", true);
                CSS.IM.UI.Util.Path.MsgSwitch = true;
                path.SelectSingleElement("SystemPath").SetAttribute("Enable", true);
                CSS.IM.UI.Util.Path.SystemSwitch = true;
                path.SelectSingleElement("CallPath").SetAttribute("Enable", true);
                CSS.IM.UI.Util.Path.CallSwitch = true;
                path.SelectSingleElement("FolderPath").SetAttribute("Enable", true);
                CSS.IM.UI.Util.Path.FolderSwitch = true;
                path.SelectSingleElement("GlobalPath").SetAttribute("Enable", true);
                CSS.IM.UI.Util.Path.GlobalSwitch = true;
                path.SelectSingleElement("InputAlertPath").SetAttribute("Enable", true);
                CSS.IM.UI.Util.Path.InputAlertSwitch = true;
            }
            config.Paths = path;
            doc.Clear();
            doc.ChildNodes.Add(config);
            doc.Save(CSS.IM.UI.Util.Path.ConfigFilename);
        }
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:44,代码来源:QQMainForm.cs

示例5: ParseDocument

 public virtual bool ParseDocument(Document doc)
 {
     doc.Clear();
     var res = ParseChildren(doc.Children);
     return res;
 }
开发者ID:simonegli8,项目名称:Silversite,代码行数:6,代码来源:Parser.cs

示例6: btn_font_Click

        /// <summary>
        /// 选择字体事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_font_Click(object sender, EventArgs e)
        {
            using (System.Windows.Forms.FontDialog fd = new FontDialog())
            {
                fd.Font = this.rtfSend.Font;
                if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    CSS.IM.UI.Util.Path.SFong = fd.Font;

                this.rtfSend.Font = CSS.IM.UI.Util.Path.SFong;

                Document doc = new Document();
                doc.LoadFile(string.Format(CSS.IM.UI.Util.Path.ConfigFilename, Program.UserName));
                Settings.Settings config = new Settings.Settings();

                CSS.IM.App.Settings.SFont font = doc.RootElement.SelectSingleElement(typeof(Settings.SFont), false) as Settings.SFont;

                if (font==null)
                {
                    font = new SFont();
                }

                font.Name = rtfSend.Font.Name;
                font.Size = rtfSend.Font.Size;
                font.Bold = rtfSend.Font.Bold;
                font.Italic = rtfSend.Font.Italic;
                font.Strikeout = rtfSend.Font.Strikeout;
                config.Font = font;
                config.Color = doc.RootElement.SelectSingleElement(typeof(Settings.SColor), false) as Settings.SColor;
                config.Paths = doc.RootElement.SelectSingleElement(typeof(Settings.Paths), false) as Settings.Paths;

                doc.Clear();
                doc.ChildNodes.Add(config);
                doc.Save(string.Format(CSS.IM.UI.Util.Path.ConfigFilename, Program.UserName));
            }
        }
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:40,代码来源:ChatFromMsg.cs

示例7: btn_FontColor_Click

        /// <summary>
        /// 选择字体颜色样式
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_FontColor_Click(object sender, EventArgs e)
        {
            using (System.Windows.Forms.ColorDialog cd = new ColorDialog())
            {
                cd.Color = this.rtfSend.ForeColor;
                if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    CSS.IM.UI.Util.Path.SColor = cd.Color;

                this.rtfSend.ForeColor = CSS.IM.UI.Util.Path.SColor;

                Document doc = new Document();
                doc.LoadFile(string.Format(CSS.IM.UI.Util.Path.ConfigFilename, Program.UserName));
                Settings.Settings config = new Settings.Settings();

                CSS.IM.App.Settings.SColor color = doc.RootElement.SelectSingleElement(typeof(Settings.SColor), false) as Settings.SColor;

                if (color==null)
                {
                    color = new SColor();
                }

                Color top_cl = rtfSend.ForeColor;
                byte[] top_cby = BitConverter.GetBytes(top_cl.ToArgb());
                color.CA = top_cby[0];
                color.CR = top_cby[1];
                color.CG = top_cby[2];
                color.CB = top_cby[3];

                config.Color = color;
                config.Font = doc.RootElement.SelectSingleElement(typeof(Settings.SFont), false) as Settings.SFont;
                config.Paths = doc.RootElement.SelectSingleElement(typeof(Settings.Paths), false) as Settings.Paths;

                doc.Clear();
                doc.ChildNodes.Add(config);
                doc.Save(string.Format(CSS.IM.UI.Util.Path.ConfigFilename, Program.UserName));
            }
        }
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:42,代码来源:ChatFromMsg.cs

示例8: Should_update_an_existing_vertex_from_a_graph_collection

 public void Should_update_an_existing_vertex_from_a_graph_collection()
 {
     Document vertex = new Document();
     vertex.Add("name", "myName");
     vertex.Add("type", "myType");
     vertex.Add("data", "myData");
     Document newVertex = g.addVertex(fromCol1, vertex, false);
     string key = newVertex.String("_key");
     vertex.Clear();
     vertex.Add("name", "myOtherName");
     vertex.Add("myKey", "myValue");
     Document v = g.updateVertex(fromCol1, key, vertex, true, true);
     Assert.True(v.Has("_id"));
     Assert.True(v.Has("_key"));
     Assert.True(v.Has("_rev"));
     Assert.True(v.Has("type"));
     Assert.AreEqual("myType", v.String("type"));
     Assert.True(v.Has("data"));
     Assert.AreEqual("myData", v.String("data"));
     Assert.True(v.Has("name"));
     Assert.AreEqual("myOtherName", v.String("name"));
     Assert.True(v.Has("myKey"));
     Assert.AreEqual("myValue", v.String("myKey"));
 }
开发者ID:jjchiw,项目名称:ArangoDB-NET,代码行数:24,代码来源:ArangoGraphTests.cs

示例9: Should_update_an_existing_edge_from_a_graph

 public void Should_update_an_existing_edge_from_a_graph()
 {
     Document vertex1 = new Document();
     vertex1.Add("name", "a");
     vertex1 = g.addVertex(fromCol1, vertex1, false);
     Document vertex2 = new Document();
     vertex2.Add("name", "b");
     vertex2 = g.addVertex(toCol1, vertex2, false);
     Document edge = new Document();
     edge.Add("_from", vertex1.String("_id"));
     edge.Add("_to", vertex2.String("_id"));
     edge.Add("r1", "1");
     edge.Add("r2", "2");
     edge = g.addEdge(edgeCol1, vertex1.String("_id"), vertex2.String("_id"), edge, false);
     string key = edge.String("_key");
     edge.Clear();
     edge.Add("blub", "blub");
     edge.Add("r1", "11");
     Document result = g.updateEdge(edgeCol1, key, edge, false, true);
     Assert.True(result.Has("r1"));
     Assert.AreEqual("11", result.String("r1"));
     Assert.True(result.Has("r2"));
     Assert.AreEqual("2", result.String("r2"));
     Assert.True(result.Has("blub"));
     Assert.AreEqual("blub", result.String("blub"));
 }
开发者ID:jjchiw,项目名称:ArangoDB-NET,代码行数:26,代码来源:ArangoGraphTests.cs

示例10: SetSendKeyType

        /// <summary>
        /// 设置发送消息的快捷键
        /// </summary>
        /// <param name="value"></param>
        public void SetSendKeyType(int value)
        {
            Document doc_setting = new Document();

            Settings.Settings config = new Settings.Settings();
            doc_setting.LoadFile(CSS.IM.UI.Util.Path.ConfigFilename);
            Settings.Paths path = doc_setting.RootElement.SelectSingleElement(typeof(Settings.Paths), false) as Settings.Paths;
            path.SendKeyType = value;
            CSS.IM.UI.Util.Path.SendKeyType = value;
            doc_setting.Clear();

            config.Paths = path;
            doc_setting.ChildNodes.Add(config);
            doc_setting.Save(CSS.IM.UI.Util.Path.ConfigFilename);
        }
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:19,代码来源:ChatForm.cs

示例11: listView_fd_friend_qcm_MouseClickEvent


//.........这里部分代码省略.........
                    //DialogResult reslut = _MoveFriendGroup.ShowDialog();

                    //String groupupdate = _MoveFriendGroup.basicComboBox1.SelectItem.ToString();

                    //String name_move = friendListView.SelectedFriend.Ritem.Jid.User;
                    //if (reslut == DialogResult.Yes)
                    //{

                    //    foreach (String user_key in friendListView.Rosters.Keys)
                    //    {
                    //        if (friendListView.Rosters[user_key].Ritem.Jid.User == name_move)
                    //        {

                    //            Friend friend_old = friendListView.Rosters[user_key];
                    //            friendListView.RemoveFriend(friendListView.Rosters[user_key].Ritem.Jid.User);

                    //            Group fgroup = friendListView.Groups[groupupdate];
                    //            friend_old.GroupID = fgroup.Id;
                    //            friend_old.GroupName = fgroup.Title;

                    //            friendListView.AddFriend(friend_old);

                    //            friendListView.UpdateLayout(3, 0);
                    //            break;

                    //        }
                    //    }

                    //    CSS.IM.XMPP.protocol.Base.Group group_move = new CSS.IM.XMPP.protocol.Base.Group(groupupdate);
                    //    CSS.IM.XMPP.protocol.Base.Item item_move = new CSS.IM.XMPP.protocol.Base.Item();
                    //    item_move.Namespace = null;
                    //    item_move.AddChild(group_move);
                    //    item_move.SetAttribute("jid", friendListView.SelectedFriend.Ritem.Jid);
                    //    item_move.SetAttribute("subscripton", "from");

                    //    CSS.IM.XMPP.protocol.Base.Query query_move = new CSS.IM.XMPP.protocol.Base.Query();
                    //    query_move.Namespace = CSS.IM.XMPP.Uri.IQ_ROSTER;
                    //    query_move.AddChild(item_move);

                    //    IQ iq = new IQ(IqType.set);
                    //    iq.GenerateId();
                    //    iq.Namespace = null;
                    //    iq.AddChild(query_move);

                    //    XmppCon.IqGrabber.SendIq(iq);
                    break;
                case "HeadSmall":
                    //listView_fd.FCType = FriendContainerType.Small;
                    CSS.IM.UI.Util.Path.FriendContainerType = false;
                    doc_setting.LoadFile(string.Format(CSS.IM.UI.Util.Path.ConfigFilename, Program.UserName));
                    path = doc_setting.RootElement.SelectSingleElement(typeof(Settings.Paths),false) as Settings.Paths;
                    path.FriendContainerType = CSS.IM.UI.Util.Path.FriendContainerType;
                    config.Paths = path;
                    config.Font = doc_setting.RootElement.SelectSingleElement(typeof(Settings.SFont), false) as Settings.SFont;
                    config.Color = doc_setting.RootElement.SelectSingleElement(typeof(Settings.SColor), false) as Settings.SColor;

                    doc_setting.Clear();
                    doc_setting.ChildNodes.Add(config);

                    try
                    {
                        doc_setting.Save(string.Format(CSS.IM.UI.Util.Path.ConfigFilename, Program.UserName));
                    }
                    catch (Exception)
                    {

                    }

                    listView_fd.FCType = CSS.IM.UI.Util.Path.FriendContainerType == true ? FriendContainerType.Big : FriendContainerType.Small;
                    chatHistory_lt.FCType = listView_fd.FCType;
                    listView_gp.FCType = listView_fd.FCType;
                    break;
                case "HeadBig":
                    //listView_fd.FCType = FriendContainerType.Small;
                    CSS.IM.UI.Util.Path.FriendContainerType = true;
                    doc_setting.LoadFile(string.Format(CSS.IM.UI.Util.Path.ConfigFilename, Program.UserName));
                    path = doc_setting.RootElement.SelectSingleElement(typeof(Settings.Paths),false) as Settings.Paths;
                    path.FriendContainerType = CSS.IM.UI.Util.Path.FriendContainerType;
                    config.Paths = path;
                    config.Font = doc_setting.RootElement.SelectSingleElement(typeof(Settings.SFont), false) as Settings.SFont;
                    config.Color = doc_setting.RootElement.SelectSingleElement(typeof(Settings.SColor), false) as Settings.SColor;

                    doc_setting.Clear();
                    doc_setting.ChildNodes.Add(config);
                    try
                    {
                        doc_setting.Save(string.Format(CSS.IM.UI.Util.Path.ConfigFilename, Program.UserName));
                    }
                    catch (Exception)
                    {

                    }
                    listView_fd.FCType = CSS.IM.UI.Util.Path.FriendContainerType == true ? FriendContainerType.Big : FriendContainerType.Small;
                    chatHistory_lt.FCType = listView_fd.FCType;
                    listView_gp.FCType = listView_fd.FCType;
                    break;
                default:
                    break;
            }
        }
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:101,代码来源:MainForm.cs

示例12: Export

        /// <summary>
        /// Export into html
        /// </summary>
        private void Export()
        {
            if ( this.Document != null ) {
                var dlg = new DlgExport( this.Document, this.fileName, this );
                bool chosen = ( (Gtk.ResponseType) dlg.Run() != Gtk.ResponseType.Close );

                while ( chosen ) {
                    Document doc = this.Document;

                    if ( dlg.NumQuestions < this.Document.CountQuestions ) {
                        // Create a new document
                        doc = new Document();
                        doc.Clear();
                        var questions = this.Document.Questions;
                        int numQuestions = Math.Min( questions.Count, dlg.NumQuestions );
                        var seq = new RandomSequence( numQuestions ).Sequence;
                        for(int i = 0; i < seq.Count; ++i) {
                            doc.Add( questions[ seq[ i ] ] );
                        }
                    }

                    this.SetStatus( "Saving..." );
                    doc.Save( dlg.OutputFormat, dlg.FileName );
                    this.SetStatus();
                    GtkUtil.Util.MsgInfo( this, AppInfo.Name, "File generated: " + dlg.FileName );
                    chosen = ( (Gtk.ResponseType) dlg.Run() != Gtk.ResponseType.Close );
                }

                dlg.Destroy();
            } else {
                this.ReportNoDocument();
            }

            return;
        }
开发者ID:Baltasarq,项目名称:Testy,代码行数:38,代码来源:MainWindowLogic.cs


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