Exemplo n.º 1
0
        public frmInfo(Project p)
        {
            this.Project = p;
            this.Project.ShowingWindow = true;

            InitializeComponent();
            this.UpdateComponents();

            this.Project.OnChange += this.UpdateChanges;

            this.lvChanges.ColumnClick += this.lvChanges_OnColumnClick;
            // initial sort
            this.lvChanges.Sorting = this.Project.SortOrder;
            this.lvChanges.ListViewItemSorter = new ListViewItemComparer(this.Project.SortColumn, this.Project.SortOrder);
            this.lvChanges.Sort();
        }
Exemplo n.º 2
0
        public bool ChangePassesFilter(Project.Change c)
        {
            // Will be used to check if this project allows for the change to be added
            /*
             * Filter, ; separated list of values aka if should not be in
             * any of the sequence Filter.Split(';')
             */

            string[] filters = this.Project.Filter.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string f in filters) {
                if (c.Fullpath.Contains(f)) {
                    // any match should terminate the check
                    return (false);
                }
            }

            return (true);
        }
Exemplo n.º 3
0
        private void AddChangeToList(Project.Change c)
        {
            if (c == null) {
                return;
            }

            if (!this.ChangePassesFilter(c)) {
                Console.WriteLine("Filter stopped change!");
                return;
            }

            ListViewItem l = new ListViewItem();
            l.Tag = c;
            l.Text = c.Last.ToLongTimeString();
            l.SubItems.Add(new ListViewItem.ListViewSubItem(l, c.Fullpath.Remove(0, this.Project.Path.Length + 1)));
            l.SubItems.Add(new ListViewItem.ListViewSubItem(l, c.ChangeType.ToString()));
            l.ToolTipText = "First: " + c.First.ToLongTimeString() + "\n"
                + "Last: " + c.Last.ToLongTimeString();

            this.lvChanges.Items.Add(l);
            this.lvChanges.Update();
        }
Exemplo n.º 4
0
        private void UpdateChanges(object sender, Project.Change c)
        {
            if (c == null && this.Project.Changes.Count == 0) {
                // happens when main window does a Clear on a project
                this.lvChanges.Items.Clear();
            }

            foreach (ListViewItem lvi in this.lvChanges.Items) {
                Project.Change cc = lvi.Tag as Project.Change;
                if (cc == c) {
                    return;
                }
            }

            this.AddChangeToList(c);
        }