Example #1
0
        private void BtnDown_Clicked(object?sender, EventArgs e)
        {
            var indices = GtkHelper.GetSelectedIndices(lvFiles);

            if (indices.Length > 0 && indices[indices.Length - 1] < this.filesListStore.IterNChildren() - 1)
            {
                var index = indices[indices.Length - 1] + 1;
                var ent   = GtkHelper.GetValueAt <InProgressDownloadItem>(lvFiles, index, 3);
                if (ent == null)
                {
                    return;
                }
                GtkHelper.RemoveAt(filesListStore, index);
                filesListStore.InsertWithValues(indices[0], ent.Name,
                                                FormattingHelper.FormatSize(ent.Size), ent.Status.ToString(), ent);
            }
        }
        void OnAddResourceButtonClicked(object sender, EventArgs e)
        {
            var newKey = _textResourcesManager.CreateAvailableKey();

            _textResourcesManager.SaveValueInMainResource(newKey, "new_value");
            var newTreeIter = _resourcesListStore.InsertWithValues(0, newKey);
            var newTreePath = _resourcesListStore.GetPath(newTreeIter);

            _textResourcesTreeView.SetCursorOnCell(newTreePath, _textResourcesTreeView.Columns[0], _textResourcesTreeView.Columns[0].Cells[0], true);
        }
Example #3
0
    private void updateTreeview()
    {
        listStore.Clear();
        var position = 0;

        foreach (var item in _myVM.FilteredItems)
        {
            listStore.InsertWithValues(position++, item.Title);
        }
    }
Example #4
0
        static void AddListstoreRows(ListStore store, params String[] names)
        {
            var theme = new IconTheme();

            foreach (var s in names)
            {
                var pixbuf = theme.LoadIcon(s, 48, (IconLookupFlags)0);
                store.InsertWithValues(-1, new object[] { s, pixbuf });
            }
        }
Example #5
0
        void UpdateHistory()
        {
            scrolledLoading.Hide();
            scrolledLog.Show();
            treeviewLog.FreezeChildNotify();
            logstore.Clear();
            var h = History;

            if (h == null)
            {
                return;
            }
            foreach (var rev in h)
            {
                if (MatchesFilter(rev))
                {
                    logstore.InsertWithValues(-1, rev, string.Empty);
                }
            }
            SetLogSearchFilter(logstore, currentFilter);
            treeviewLog.ThawChildNotify();
        }
Example #6
0
        private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow"))
        {
            builder.Autoconnect(this);

            DeleteEvent      += Window_DeleteEvent;
            _button1.Clicked += Button1_Clicked;

            // Create a column for the artist name
            var            cellView     = new CellRendererText();
            TreeViewColumn artistColumn = new TreeViewColumn("Artist", cellView);

            artistColumn.AddAttribute(cellView, "text", 0);

            // Create a column for the song title
            var            cellView1  = new CellRendererText();
            TreeViewColumn songColumn = new TreeViewColumn("Song Title", cellView1);

            songColumn.AddAttribute(cellView1, "text", 1);

            // Add the columns to the TreeView
            tree.AppendColumn(artistColumn);

            tree.AppendColumn(songColumn);

            // Create a model that will hold two strings - Artist Name and Song Title
            ListStore musicListStore = new ListStore(typeof(string), typeof(string));

            // Assign the model to the TreeView
            tree.Model = musicListStore;

            musicListStore.InsertWithValues(0, 678, 876);
            musicListStore.InsertWithValues(0, 567, 765.567);
            musicListStore.InsertWithValues(0, 456, 654.456);
            musicListStore.InsertWithValues(0, 345, 543.345);
            musicListStore.InsertWithValues(0, 234, 432.234);
            musicListStore.InsertWithValues(0, 123, 321.123);

            tree.CursorChanged += OnCursorChanged;
        }
Example #7
0
        public void Reset()
        {
            try {
                treeView.FreezeChildNotify();
                store.Clear();

                bool isPcl = configureProject.IsPortableLibrary;

                foreach (SystemAssembly systemAssembly in targetContext.GetAssemblies(targetVersion))
                {
                    if (systemAssembly.Package.IsFrameworkPackage && (isPcl || systemAssembly.Name == "mscorlib"))
                    {
                        continue;
                    }

                    bool   selected = IsSelected(ReferenceType.Package, systemAssembly.FullName, systemAssembly.Package.Name);
                    int    matchRank = 0;
                    string name, version;

                    if (stringMatcher != null)
                    {
                        string txt = systemAssembly.Name + " " + systemAssembly.Version;
                        if (!stringMatcher.CalcMatchRank(txt, out matchRank))
                        {
                            continue;
                        }
                        int [] match = stringMatcher.GetMatch(txt);
                        name    = GetMatchMarkup(treeView, systemAssembly.Name, match, 0);
                        version = GetMatchMarkup(treeView, systemAssembly.Version, match, systemAssembly.Name.Length + 1);
                    }
                    else
                    {
                        name    = GLib.Markup.EscapeText(systemAssembly.Name);
                        version = GLib.Markup.EscapeText(systemAssembly.Version);
                    }
                    string pkg = systemAssembly.Package.GetDisplayName();
                    if (systemAssembly.Package.IsInternalPackage)
                    {
                        pkg += " " + GettextCatalog.GetString("(Provided by {0})", BrandingService.ApplicationName);
                    }

                    store.InsertWithValues(-1,
                                           name,
                                           version,
                                           systemAssembly,
                                           selected,
                                           systemAssembly.FullName,
                                           pkg,
                                           MonoDevelop.Ide.Gui.Stock.Package,
                                           matchRank,
                                           null,
                                           ReferenceType.Package);
                }

                if (showAll)
                {
                    Solution openSolution = configureProject.ParentSolution;
                    if (openSolution == null)
                    {
                        return;
                    }

                    Dictionary <DotNetProject, bool> references = new Dictionary <DotNetProject, bool> ();

                    foreach (Project projectEntry in openSolution.GetAllItems <Project> ())
                    {
                        if (projectEntry == configureProject)
                        {
                            continue;
                        }

                        bool   selected  = IsSelected(ReferenceType.Project, projectEntry.Name, "");
                        int    matchRank = 0;
                        string name;

                        if (stringMatcher != null)
                        {
                            if (!stringMatcher.CalcMatchRank(projectEntry.Name, out matchRank))
                            {
                                continue;
                            }
                            int [] match = stringMatcher.GetMatch(projectEntry.Name);
                            name = GetMatchMarkup(treeView, projectEntry.Name, match, 0);
                        }
                        else
                        {
                            name = GLib.Markup.EscapeText(projectEntry.Name);
                        }

                        DotNetProject netProject = projectEntry as DotNetProject;
                        if (netProject != null)
                        {
                            if (ProjectReferencePanel.ProjectReferencesProject(references, null, netProject, configureProject.Name))
                            {
                                continue;
                            }

                            string reason;
                            if (!configureProject.CanReferenceProject(netProject, out reason))
                            {
                                continue;
                            }
                        }
                        store.InsertWithValues(-1, name, "", null, selected, projectEntry.FileName.ToString(), "", projectEntry.StockIcon, matchRank, projectEntry.Name, ReferenceType.Project);
                    }

                    foreach (FilePath file in selectDialog.GetRecentFileReferences())
                    {
                        bool   selected  = IsSelected(ReferenceType.Assembly, file, "");
                        int    matchRank = 0;
                        string fname     = file.FileName;
                        string name;

                        string version = string.Empty;
                        try {
                            string sname = SystemAssemblyService.GetAssemblyName(file);
                            var    aname = SystemAssemblyService.ParseAssemblyName(sname);
                            version = aname.Version.ToString();
                        } catch {
                            continue;
                        }

                        if (stringMatcher != null)
                        {
                            if (!stringMatcher.CalcMatchRank(fname, out matchRank))
                            {
                                continue;
                            }
                            int [] match = stringMatcher.GetMatch(fname);
                            name = GetMatchMarkup(treeView, fname, match, 0);
                        }
                        else
                        {
                            name = GLib.Markup.EscapeText(fname);
                        }
                        store.InsertWithValues(-1, name, version, null, selected, (string)file, GLib.Markup.EscapeText(file), MonoDevelop.Ide.Gui.Stock.OpenFolder, matchRank, null, ReferenceType.Assembly);
                    }
                }
            } finally {
                treeView.ThawChildNotify();
            }
        }