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


C# ListStore.Clear方法代码示例

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


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

示例1: ListCategoriaView

		public ListCategoriaView ()
		{
			this.Build ();

			deleteAction.Sensitive = false;
			editAction.Sensitive = false;

			dbConnection = App.Instance.DbConnection;


			treeView.AppendColumn ("id", new CellRendererText (), "text", 0);
			treeView.AppendColumn ("nombre", new CellRendererText (), "text", 1);
			listStore = new ListStore (typeof(ulong), typeof(string));
			treeView.Model = listStore;

			fillListStore ();

			treeView.Selection.Changed += selectionChanged;

			refreshAction.Activated += delegate {
				listStore.Clear();
				fillListStore();
			};

		}
开发者ID:rlloret,项目名称:AD,代码行数:25,代码来源:ListCategoriaView.cs

示例2: Copy

        public static void Copy(TreeModel tree, ListStore list)
        {
                list.Clear();

                TreeIter tree_iter;
                if (tree.IterChildren(out tree_iter)) {
                        Copy(tree, tree_iter, list, true);
                }
        }
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:9,代码来源:DependentListStore.cs

示例3: fillListStore

 private void fillListStore(ListStore listStore)
 {
     listStore.Clear ();
     IDbCommand dbCommand = App.Instace.DbConnection.CreateCommand ();
     dbCommand.CommandText = "select * from categoria order by id";
     IDataReader dataReader = dbCommand.ExecuteReader ();
     while (dataReader.read())
         listStore.AppendValues (dataReader ["id"], dataReader ["nombre"]);
     dataReader.close();
 }
开发者ID:damdsanchez,项目名称:ed,代码行数:10,代码来源:MainWindow.cs

示例4: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();
        mySqlConnection.Open();
        MySqlCommand mySqlCommand=mySqlConnection.CreateCommand();
        mySqlCommand.CommandText= "select * from categoria";
        MySqlDataReader mysqlDataReader= mySqlCommand.ExecuteReader();
        int fieldcount=mysqlDataReader.FieldCount;

        creaColumnas(fieldcount,mysqlDataReader);
        ListStore listStore=new ListStore(creaTipos(fieldcount));
        rellenar(fieldcount,listStore,mysqlDataReader);
        mysqlDataReader.Close();

        removeAction.Sensitive=false;
        treeView.Model=listStore;
        TreeIter iter;

        treeView.Selection.Changed+=delegate{
            bool isSelected=treeView.Selection.GetSelected(out iter);
            if(isSelected)
                removeAction.Sensitive=true;
            else
                removeAction.Sensitive=false;
        };

        removeAction.Activated +=delegate{
            string nombre=listStore.GetValue(iter,1).ToString();
            MessageDialog md2 = new MessageDialog
                        (this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo,"¿Seguro que quieres borrarlo? \n Borrar: "+nombre);

            ResponseType result = (ResponseType)md2.Run ();
            string op=listStore.GetValue(iter,0).ToString();

            if (result == ResponseType.Yes){
                MySqlCommand delete=mySqlConnection.CreateCommand();
                delete.CommandText= "Delete from categoria where id="+op+"";
                delete.ExecuteNonQuery();
                md2.Destroy();

                for (int i=0;i<fieldcount;i++){//elimina columnas
                    treeView.RemoveColumn(treeView.GetColumn(0));
                }
                listStore.Clear();//vacia el modelo
                //volvemos a mostrar treview actualizado
                actualizar(mySqlCommand,listStore);

            }
            else{
                md2.Destroy();

            }
        };
    }
开发者ID:nerea123,项目名称:ad,代码行数:55,代码来源:MainWindow.cs

示例5: refreshTreeView

        public static void refreshTreeView()
        {
            listStore =(ListStore) treeView.Model;
            listStore.Clear ();

            IEnumerable<IList> values = queryResult.Rows;

            foreach (IList k in values) {
                listStore.AppendValues (k);

            }
        }
开发者ID:c-trives,项目名称:ad,代码行数:12,代码来源:TreeViewHelperStatic.cs

示例6: fillListStore

    private void fillListStore(ListStore listStore)
    {
        listStore.Clear ();

        IDbCommand dbcommand = App.Instance.DbConnection.CreateCommand ();
        dbcommand.CommandText = "select * from categoria order by id";
        IDataReader dataReader = dbcommand.ExecuteReader ();
        while (dataReader.Read()) {
            //Console.WriteLine ("id={0} nombre={1}", dataReader ["id"], dataReader ["nombre"]);
            listStore.AppendValues (dataReader ["id"], dataReader ["nombre"]);
        }
        dataReader.Close ();
    }
开发者ID:andre27593,项目名称:ed,代码行数:13,代码来源:MainWindow.cs

示例7: ListArticuloView

		public ListArticuloView ()
		{
			this.Build ();
			deleteAction.Sensitive = false;
			editAction.Sensitive = false;

			dbConnection = App.Instance.DbConnection;

			treeView.AppendColumn ("id", new CellRendererText (), "text", 0);
			treeView.AppendColumn ("nombre", new CellRendererText (), "text", 1);
			treeView.AppendColumn ("categoria", new CellRendererText (), "text", 2);
			//articuloTreeView.AppendColumn ("precio", new CellRendererText (), "text", 3);

			treeView.AppendColumn ("precio", new CellRendererText (), 
			                               new TreeCellDataFunc (delegate(TreeViewColumn tree_column, CellRenderer cell, 
			                               TreeModel tree_model, TreeIter iter) {
				object value = tree_model.GetValue(iter, 3);
				((CellRendererText)cell).Text = value != DBNull.Value ? value.ToString() : "null";
			})
			                               );
			listStore = new ListStore (typeof(ulong), typeof(string), 
			                                   typeof(string), typeof(decimal));
			treeView.Model = listStore;

			fillListStore ();

			treeView.Selection.Changed += selectionChanged;

			refreshAction.Activated += delegate {
				listStore.Clear();
				fillListStore();
			};

			editAction.Activated += delegate {
				new ArticuloView();

			};

			//TODO resto de actions
		}
开发者ID:rlloret,项目名称:AD,代码行数:40,代码来源:ListArticuloView.cs

示例8: Refresh

		public static void Refresh(ListStore listStore){
			listStore.Clear ();
		}
开发者ID:rlloret,项目名称:AD,代码行数:3,代码来源:ListAll.cs

示例9: MainWindow


//.........这里部分代码省略.........
                md2.Destroy();

                }
            }
        };

        notebook1.SwitchPage+=delegate{
            if(esCategoria()){
                    bool isSelected=treeview2.Selection.GetSelected(out iter);
                    if(isSelected){
                        InfoAction.Sensitive=true;
                        addAction.Sensitive=true;
                        deleteAction.Sensitive=true;
                        refreshAction.Sensitive=true;
                    }
                    else{
                        InfoAction.Sensitive=false;
                        //addAction.Sensitive=false;
                        deleteAction.Sensitive=false;
                        //refreshAction.Sensitive=false;
                }
            }
            else{
                bool isSelected=treeview1.Selection.GetSelected(out iter);
                if(isSelected){
                    InfoAction.Sensitive=true;
                    addAction.Sensitive=true;
                    deleteAction.Sensitive=true;
                    refreshAction.Sensitive=true;
                }
                else{
                    InfoAction.Sensitive=false;
                    //addAction.Sensitive=false;
                    deleteAction.Sensitive=false;
                    //refreshAction.Sensitive=false;
                }
            }
        };
        treeview1.Selection.Changed +=delegate{

            if(!esCategoria()){
                bool isSelected=treeview1.Selection.GetSelected(out iter);
                if(isSelected){
                    InfoAction.Sensitive=true;
                    //addAction.Sensitive=true;
                    deleteAction.Sensitive=true;
                    refreshAction.Sensitive=true;
                }
                else{
                    InfoAction.Sensitive=false;
                    //addAction.Sensitive=false;
                    deleteAction.Sensitive=false;
                    //refreshAction.Sensitive=false;
                }
            }
        };

            treeview2.Selection.Changed +=delegate{

                if(esCategoria()){
                    bool isSelected=treeview2.Selection.GetSelected(out iter);
                    if(isSelected){
                        InfoAction.Sensitive=true;
                        //addAction.Sensitive=true;
                        deleteAction.Sensitive=true;
                        refreshAction.Sensitive=true;
                    }
                    else{
                        InfoAction.Sensitive=false;
                        //addAction.Sensitive=false;
                        deleteAction.Sensitive=false;
                        //refreshAction.Sensitive=false;
                }
            }
        };

        refreshAction.Activated +=delegate{
            if(esCategoria()){
                listStore=tree1.ListStore;
                fielCountCategoria=tree1.getFieldCount();
                for (int i=0;i<fielCountCategoria;i++){//elimina columnas
                    treeview2.RemoveColumn(treeview2.GetColumn(0));
                }
                listStore.Clear();
                listStore=tree1.ListStore;
                tree1.actualizar(dbCommand,listStore);

            }
            else{
                listStore=tree2.ListStore;
                fieldCountArticulo=tree2.getFieldCount();
                for (int i=0;i<fieldCountArticulo;i++){//elimina columnas
                    treeview1.RemoveColumn(treeview1.GetColumn(0));
                }
                listStore.Clear();
                listStore=tree2.ListStore;
                tree2.actualizar(dbCommand,listStore);
            }
        };
    }
开发者ID:nerea123,项目名称:ad,代码行数:101,代码来源:MainWindow.cs

示例10: SetupWidgets

        private void SetupWidgets()
        {
            histogram_expander = new Expander (Catalog.GetString ("Histogram"));
            histogram_expander.Activated += delegate(object sender, EventArgs e) {
                ContextSwitchStrategy.SetHistogramVisible (Context, histogram_expander.Expanded);
                UpdateHistogram ();
            };
            histogram_expander.StyleSet += delegate(object sender, StyleSetArgs args) {
                Gdk.Color c = this.Toplevel.Style.Backgrounds[(int)Gtk.StateType.Active];
                histogram.RedColorHint = (byte)(c.Red / 0xff);
                histogram.GreenColorHint = (byte)(c.Green / 0xff);
                histogram.BlueColorHint = (byte)(c.Blue / 0xff);
                histogram.BackgroundColorHint = 0xff;
                UpdateHistogram ();
            };
            histogram_image = new Gtk.Image ();
            histogram = new Histogram ();
            histogram_expander.Add (histogram_image);

            Add (histogram_expander);

            info_expander = new Expander (Catalog.GetString ("Image Information"));
            info_expander.Activated += (sender, e) => {
                ContextSwitchStrategy.SetInfoBoxVisible (Context, info_expander.Expanded);
            };

            info_table = new Table (head_rows, 2, false) { BorderWidth = 0 };

            AddLabelEntry (null, null, null, null,
                           photos => { return String.Format (Catalog.GetString ("{0} Photos"), photos.Length); });

            AddLabelEntry (null, Catalog.GetString ("Name"), null,
                           (photo, file) => { return photo.Name ?? String.Empty; }, null);

            version_list = new ListStore (typeof(IPhotoVersion), typeof(string), typeof(bool));
            version_combo = new ComboBox ();
            CellRendererText version_name_cell = new CellRendererText ();
            version_name_cell.Ellipsize = Pango.EllipsizeMode.End;
            version_combo.PackStart (version_name_cell, true);
            version_combo.SetCellDataFunc (version_name_cell, new CellLayoutDataFunc (VersionNameCellFunc));
            version_combo.Model = version_list;
            version_combo.Changed += OnVersionComboChanged;

            AddEntry (null, Catalog.GetString ("Version"), null, version_combo, 0.5f,
                      (widget, photo, file) => {
                            version_list.Clear ();
                            version_combo.Changed -= OnVersionComboChanged;

                            int count = 0;
                            foreach (IPhotoVersion version in photo.Versions) {
                                version_list.AppendValues (version, version.Name, true);
                                if (version == photo.DefaultVersion)
                                    version_combo.Active = count;
                                count++;
                            }

                            if (count <= 1) {
                                version_combo.Sensitive = false;
                                version_combo.TooltipText = Catalog.GetString ("(No Edits)");
                            } else {
                                version_combo.Sensitive = true;
                                version_combo.TooltipText =
                                    String.Format (Catalog.GetPluralString ("(One Edit)", "({0} Edits)", count - 1),
                                                   count - 1);
                            }
                            version_combo.Changed += OnVersionComboChanged;
                       }, null);

            AddLabelEntry ("date", Catalog.GetString ("Date"), Catalog.GetString ("Show Date"),
                           (photo, file) => {
                               return String.Format ("{0}{2}{1}",
                                                     photo.Time.ToShortDateString (),
                                                     photo.Time.ToShortTimeString (),
                                                     Environment.NewLine); },
                           photos => {
                                IPhoto first = photos[photos.Length - 1];
                                IPhoto last = photos[0];
                                if (first.Time.Date == last.Time.Date) {
                                    //Note for translators: {0} is a date, {1} and {2} are times.
                                    return String.Format (Catalog.GetString ("On {0} between \n{1} and {2}"),
                                                          first.Time.ToShortDateString (),
                                                          first.Time.ToShortTimeString (),
                                                          last.Time.ToShortTimeString ());
                                } else {
                                    return String.Format (Catalog.GetString ("Between {0} \nand {1}"),
                                                          first.Time.ToShortDateString (),
                                                          last.Time.ToShortDateString ());
                                }
                           });

            AddLabelEntry ("size", Catalog.GetString ("Size"), Catalog.GetString ("Show Size"),
                           (photo, metadata) => {
                                int width = metadata.Properties.PhotoWidth;
                                int height = metadata.Properties.PhotoHeight;

                                if (width != 0 && height != 0)
                                    return String.Format ("{0}x{1}", width, height);
                                else
                                    return Catalog.GetString ("(Unknown)");
                           }, null);
//.........这里部分代码省略.........
开发者ID:nathansamson,项目名称:F-Spot-Album-Exporter,代码行数:101,代码来源:InfoBox.cs

示例11: XmlSchemasPanelWidget

		public XmlSchemasPanelWidget ()
		{
			Build ();
			
			//set up tree view for default schemas
			var textRenderer = new CellRendererText ();
			registeredSchemasStore = new ListStore (typeof (XmlSchemaCompletionData));
			registeredSchemasView.Model = registeredSchemasStore;
			
			registeredSchemasView.AppendColumn (GettextCatalog.GetString ("Namespace"), textRenderer,
				(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) => {
					((CellRendererText)cell).Text = GetSchema (iter).NamespaceUri;
				}
			);
			
			registeredSchemasView.AppendColumn (GettextCatalog.GetString ("Type"), textRenderer,
				(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) => {
					((CellRendererText)cell).Text = GetSchema (iter).ReadOnly? 
						  GettextCatalog.GetString ("Built in") 
						: GettextCatalog.GetString ("User schema");
			});
			
			registeredSchemasStore.SetSortFunc (0, SortSchemas);
			
			registeredSchemasStore.SetSortColumnId (0, SortType.Ascending);
			
			//update state of "remove" button depending on whether schema is read-only and anything's slected
			registeredSchemasView.Selection.Changed += delegate {
				var data = GetSelectedSchema ();
				registeredSchemasRemoveButton.Sensitive = (data != null && !data.ReadOnly);
			};
			registeredSchemasRemoveButton.Sensitive = false;
			
			//set up cells for associations
			var extensionTextRenderer = new CellRendererText ();
			extensionTextRenderer.Editable = true;
			var prefixTextRenderer = new CellRendererText ();
			prefixTextRenderer.Editable = true;
			
			var comboEditor = new CellRendererCombo ();
			registeredSchemasComboModel = new ListStore (typeof (string));
			comboEditor.Model = registeredSchemasComboModel;
			comboEditor.Mode = CellRendererMode.Editable;
			comboEditor.TextColumn = 0;
			comboEditor.Editable = true;
			comboEditor.HasEntry = false;
			
			//rebuild combo's model from default schemas whenever editing starts
			comboEditor.EditingStarted += delegate (object sender, EditingStartedArgs args) {
				registeredSchemasComboModel.Clear ();
				registeredSchemasComboModel.AppendValues (string.Empty);
				foreach (TreeIter iter in WalkStore (registeredSchemasStore))
					registeredSchemasComboModel.AppendValues (
						GetSchema (iter).NamespaceUri
					);
				args.RetVal = true;
				registeredSchemasComboModel.SetSortColumnId (0, SortType.Ascending);
			};
			
			//set up tree view for associations
			defaultAssociationsStore = new ListStore (typeof (string), typeof (string), typeof (string), typeof (bool));
			defaultAssociationsView.Model = defaultAssociationsStore;
			defaultAssociationsView.AppendColumn (GettextCatalog.GetString ("File Extension"), extensionTextRenderer, "text", COL_EXT);
			defaultAssociationsView.AppendColumn (GettextCatalog.GetString ("Namespace"), comboEditor, "text", COL_NS);
			defaultAssociationsView.AppendColumn (GettextCatalog.GetString ("Prefix"), prefixTextRenderer, "text", COL_PREFIX);
			defaultAssociationsStore.SetSortColumnId (COL_EXT, SortType.Ascending);
			
			//editing handlers
			extensionTextRenderer.Edited += handleExtensionSet;
			comboEditor.Edited += (sender, args) => setAssocValAndMarkChanged (args.Path, COL_NS, args.NewText ?? "");
			prefixTextRenderer.Edited += delegate (object sender, EditedArgs args) {
				foreach (char c in args.NewText)
					if (!char.IsLetterOrDigit (c))
						//FIXME: give an error message?
						return;
				setAssocValAndMarkChanged (args.Path, COL_PREFIX, args.NewText);
			};
			
			//update state of "remove" button depending on whether anything's slected
			defaultAssociationsView.Selection.Changed += delegate {
				TreeIter iter;
				defaultAssociationsRemoveButton.Sensitive =
					defaultAssociationsView.Selection.GetSelected (out iter);
			};
			defaultAssociationsRemoveButton.Sensitive = false;
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:86,代码来源:XmlSchemasPanelWidget.cs

示例12: RePopulateClient

        /// <summary>
        /// Remplir le combo box à la voler avec l'information donnée.
        /// </summary>
        /// <param name="clients">Clients.</param>
        protected void RePopulateClient(DataSet clients)
        {
            ListStore model = new ListStore (typeof(string));
            CellRendererText cellrenderer = new CellRendererText ();

            clientBox.Model = model;
            clientBox.PackStart (cellrenderer, true);
            iDClient.Clear ();
            ClientPhone.Clear ();
            model.Clear ();

            for (int i = 0; i < clients.Tables [0].Rows.Count; i++) {
                StringBuilder sb = new StringBuilder ();
                sb.Append (clients.Tables [0].Rows [i].ItemArray [1].ToString () + " ");
                sb.Append (clients.Tables [0].Rows [i].ItemArray [2].ToString () + " ");
                sb.Append (clients.Tables [0].Rows [i].ItemArray [3].ToString () + " ");

                iDClient.Add (clients.Tables [0].Rows [i].ItemArray [0].ToString ());
                ClientPhone.Add (clients.Tables [0].Rows [i].ItemArray [3].ToString ());

                clientBox.AddAttribute (cellrenderer, "text", 0);

                model.AppendValues (sb.ToString ());

            }
            clientBox.Active = 0;
            clientSelectionne.Sensitive = true;
        }
开发者ID:JeffLabonte,项目名称:MultiLocation,代码行数:32,代码来源:ChoixWindow.cs

示例13: PopulateLibrary

    public void PopulateLibrary(ListStore list)
    {
        list.Clear ();
        if (Directory.Exists (AppDomain.CurrentDomain.BaseDirectory + "/Games")) {
            //If the Games directory exists, start iterating through each subdirectory
            string[] dirs = Directory.GetDirectories(AppDomain.CurrentDomain.BaseDirectory + "/Games");
            //If the games directory actually HAS games, add 'em to the library.
            if (dirs.Length > 0) {
                foreach (string dir in dirs) {
                    if (File.Exists (dir + "/metadata.json")) {
                        DirectoryInfo dirinf = new DirectoryInfo (dir);
                        string metadatajson = File.ReadAllText (dir + "/metadata.json");
                        GameInfo game = Newtonsoft.Json.JsonConvert.DeserializeObject<GameInfo> (metadatajson);
                        list.AppendValues (game.Name, game, dirinf.Name);

                    }
                }
                //If not, tell the user they don't have any.
            } else {
                list.AppendValues ("No games installed yet.");
            }
        } else {
            //If not, create the directory.
            Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "/Games");
            list.AppendValues ("No games installed yet.");
        }
    }
开发者ID:TheUltimateHacker,项目名称:Shifted_Games_Launcher,代码行数:27,代码来源:MainWindow.cs

示例14: CreateInputMappingColumnWithComboBox

        /// <summary>
        /// Creates the input mapping column with combo box.
        /// TODO improve the input mapping combo box:
        /// 1. it doesn't set values until combo box loses focus within table view confirm change - Edited event is raised only then
        /// 2. there is no indication that the field can be modified - render combo box always, OR show some icon that it can be modified
        /// </summary>
        /// <returns>
        /// The input mapping column with combo box.
        /// </returns>
        /// <param name='inputStore'>
        /// Input store.
        /// </param>
        private TreeViewColumn CreateInputMappingColumnWithComboBox(NodeStore inputStore, string columntTitle)
        {
            Gtk.CellRendererCombo comboRenderer = new Gtk.CellRendererCombo();
            
            comboRenderer.HasEntry = false;
            comboRenderer.Mode = CellRendererMode.Editable;
            comboRenderer.TextColumn = 0;
            comboRenderer.Editable = true;

            ListStore comboBoxStore = new ListStore (typeof(string));
            comboRenderer.Model = comboBoxStore;

            //when user activates combo box, refresh combobox store with available input mapping per node
            comboRenderer.EditingStarted += delegate (object o, EditingStartedArgs args) 
            {
                comboBoxStore.Clear ();
                IOItemNode currentItem = (IOItemNode)inputStore.GetNode (new TreePath (args.Path));
                ExperimentNode currentNode = m_component.ExperimentNode;
                string currentType = currentItem.Type;
                InputMappings availableInputMappingsPerNode = new InputMappings (currentNode.Owner);
                if (currentNode != null && availableInputMappingsPerNode.ContainsMappingsForNode (currentNode)) {
                    foreach (string incomingOutput in availableInputMappingsPerNode [currentNode].Keys) {
                        if (string.Equals (currentType, availableInputMappingsPerNode [currentNode] [incomingOutput])) {
                            comboBoxStore.AppendValues (Mono.Unix.Catalog.GetString (incomingOutput));
                        }
                    }
                }
            };

            //when edition has been completed set current item node with proper mapping
            comboRenderer.Edited += delegate (object o, EditedArgs args) {
                IOItemNode n = (IOItemNode)inputStore.GetNode (new TreePath (args.Path));
                n.MappedTo = args.NewText;
                RefreshIOHighlightInExperiment(n.MappedTo);
            };

            //finally create the column with above combo renderer
            var mappedToColumn = new TreeViewColumn ();
            mappedToColumn.Title = columntTitle;
            mappedToColumn.PackStart (comboRenderer, true);

            //this method sets the text view to current mapping, when combo box is not active
            mappedToColumn.SetCellDataFunc (comboRenderer, delegate (TreeViewColumn tree_column, CellRenderer cell, ITreeNode node) {
                IOItemNode currentItem = (IOItemNode)node;
                comboRenderer.Text = currentItem.MappedTo;
            });

            return mappedToColumn;
        }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:61,代码来源:ComponentInfoPanel.cs

示例15: OnButton2Clicked

    protected void OnButton2Clicked(object sender, EventArgs e)
    {
        printed = false;
        varList.Clear ();
        consoletext.Buffer.Clear();

        string code = textview1.Buffer.Text;
        string[] codearray = code.Split ('\n');

        string hairegex = @"^\s*(I HAS A) ([a-zA-Z][a-zA-Z0-9]*) ?(ITZ)? ?(.+)?";
        string startregex = @"^\s*(HAI)\s*$";
        string visibleregex = @"\s*(VISIBLE) (.*)";
        string commentregex = @"\s*(OBTW)";
        string endregex = @"^\s*(KTHXBYE)\s*$";
        string endcommentregex = @"(TLDR)\s*$";
        string numvarwtfregex = @"(([a-zA-Z][a-zA-Z0-9]*), WTF?)|((-?[0-9]*\.?[0-9]+), WTF?)";

        string addregex = @"^\s*(SUM OF)";
        string subregex = @"^\s*(DIFF OF)";
        string mulregex = @"^\s*(PRODUKT OF)";
        string divregex = @"^\s*(QUOSHUNT OF)";
        string modregex = @"^\s*(MOD OF)";
        string biggrregex = @"^\s*(BIGGR OF)";
        string smallrregex = @"^\s*(SMALLR OF)";
        string scommentregex = "(BTW) (.*)";
        string bothofregex = @"^\s*(BOTH OF)";
        string eitherofregex = @"^\s*(EITHER OF)";
        string wonofregex = @"^\s*(WON OF)";
        string notregex = @"^\s*(NOT)";
        string allofregex = @"^\s*(ALL OF)";
        string anyofregex = @"^\s*(ANY OF)";
        string bothsaemregex = @"^\s*(BOTH SAEM)";
        string diffrintregex = @"^\s*(DIFFRINT)";
        string smooshregex = "(DIFF OF) (\")(.*)(\") (AN) (\")(.*)(\")";
        string gimmehregex = "(GIMMEH) ([a-zA-Z][a-zA-Z0-9]*)";
        string assregex = "([a-zA-Z][a-zA-Z0-9]*) (R) (.*)";
        string variregex = "([a-zA-Z][a-zA-Z0-9]*)";
        string numregex = @"(-?[0-9]*\.?[0-9]+)";
        string stringregex ="(\")(.*)(\")";
        string opsregex = "(SUM OF)|(DIFF OF)|(PRODUKT OF)|(QUOSHUNT OF)|(MOD OF)|(BIGGR OF)|(SMALLR OF)|(AN)";

        Gtk.ListStore lex = new Gtk.ListStore (typeof (string), typeof (string));
        Gtk.ListStore sym = new Gtk.ListStore (typeof (string), typeof (string));

        lex.Clear ();
        treeview1.Model = lex;
        sym.Clear ();
        symboltreeview.Model = sym;

        //Keyword regexes
        Regex start = new Regex (startregex, RegexOptions.IgnoreCase);
        Regex vardec = new Regex (hairegex, RegexOptions.IgnoreCase);
        Regex print = new Regex (visibleregex, RegexOptions.IgnoreCase);
        Regex comment = new Regex (commentregex, RegexOptions.IgnoreCase);
        Regex endcomment = new Regex (endcommentregex, RegexOptions.IgnoreCase);
        Regex end = new Regex (endregex, RegexOptions.IgnoreCase);
        Regex add = new Regex (addregex, RegexOptions.IgnoreCase);
        Regex sub = new Regex (subregex, RegexOptions.IgnoreCase);
        Regex mul = new Regex (mulregex, RegexOptions.IgnoreCase);
        Regex div = new Regex (divregex, RegexOptions.IgnoreCase);
        Regex mod = new Regex (modregex, RegexOptions.IgnoreCase);
        Regex big = new Regex (biggrregex, RegexOptions.IgnoreCase);
        Regex small = new Regex (smallrregex, RegexOptions.IgnoreCase);
        Regex both = new Regex (bothofregex, RegexOptions.IgnoreCase);
        Regex either = new Regex (eitherofregex, RegexOptions.IgnoreCase);
        Regex won = new Regex (wonofregex, RegexOptions.IgnoreCase);
        Regex not = new Regex (notregex, RegexOptions.IgnoreCase);
        Regex allof = new Regex (allofregex, RegexOptions.IgnoreCase);
        Regex anyof = new Regex (anyofregex, RegexOptions.IgnoreCase);
        Regex bothsaem = new Regex (bothsaemregex, RegexOptions.IgnoreCase);
        Regex diffrint = new Regex (diffrintregex, RegexOptions.IgnoreCase);

        //Data type regexes
        Regex numvarwtf = new Regex(numvarwtfregex, RegexOptions.IgnoreCase);
        Regex vari = new Regex (variregex, RegexOptions.IgnoreCase);
        Regex numb =new Regex (numregex, RegexOptions.IgnoreCase);
        Regex str =new Regex (stringregex);
        Regex gimmeh = new Regex (gimmehregex, RegexOptions.IgnoreCase);
        Regex ops = new Regex (opsregex, RegexOptions.IgnoreCase);
        Regex ass = new Regex (assregex, RegexOptions.IgnoreCase);

        HashSet <string> lexemeHash = new HashSet<string> (StringComparer.OrdinalIgnoreCase);

        //Initialize requirements
        Stack delimiter = new Stack();
        List<string> ifelse = new List<string> ();
        int linenumber = 0;
        int len = codearray.Length;
        int commentline = 0;
        bool satisfy = true;
        bool gtfo = false;
        int startpoint = 0;
        int endpoint = 0;
        int ifcaller = 0;
        int ifcounter = 0;
        int oiccounter = 0;
        int j = 0;
        string targetArray = "";

        for(int i = 0; i<codearray.Length; i++){
//.........这里部分代码省略.........
开发者ID:altusgerona,项目名称:cmsc124lolterpreter,代码行数:101,代码来源:MainWindow.cs


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