Exemplo n.º 1
0
 private void toolStripMenuItem4_Click(object sender, EventArgs e)
 {
     if (watchListEditsView.SelectedItems.Count != 0)
     {
         EditListViewItem           selectedItem = watchListEditsView.SelectedItems[0] as EditListViewItem;
         System.Diagnostics.Process process      = new System.Diagnostics.Process();
         process.StartInfo.UseShellExecute = true;
         process.StartInfo.FileName        = selectedItem.Diff;
         process.Start();
     }
 }
Exemplo n.º 2
0
        private void recentChangesListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            PageListViewItem selectedItem = recentChangesListView.SelectedItems.Count > 0 ? (PageListViewItem)recentChangesListView.SelectedItems[0] : null;

            if (selectedItem != null)
            {
                string page = selectedItem.SubItems[2].Text;
                detailsListView.BeginUpdate();
                detailsListView.SuspendLayout();
                detailsListView.Items.Clear();

                using (SQLiteCommand command = new SQLiteCommand(_connection))
                {
                    SQLiteParameter pageValue = new SQLiteParameter("@page");
                    pageValue.Value = selectedItem.Page;
                    command.Parameters.Add(pageValue);
                    SQLiteParameter namespaceValue = new SQLiteParameter("@namespace");
                    namespaceValue.Value = selectedItem.Namespace;
                    command.Parameters.Add(namespaceValue);
                    command.CommandText = @"SELECT timestamp, flags, size, user, summary, id, oldid
                                            FROM [edits]
                                            WHERE page=@page AND namespace=@namespace
                                            ORDER by timestamp DESC";
                    using (SQLiteDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            int size;
                            int.TryParse(reader[2].ToString(), out size);
                            int flags;
                            int.TryParse(reader[1].ToString(), out flags);
                            long diff;
                            long.TryParse(reader[5].ToString(), out diff);
                            long oldid;
                            long.TryParse(reader[6].ToString(), out oldid);

                            EditListViewItem item = new EditListViewItem(reader[0].ToString(),
                                                                         WikiEdit.FlagsToString((EditFlags)flags),
                                                                         size,
                                                                         reader[3].ToString(),
                                                                         reader[4].ToString(),
                                                                         diff,
                                                                         oldid);

                            detailsListView.Items.Add(item);
                        }
                        detailsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    }
                }
                detailsListView.ResumeLayout();
                detailsListView.EndUpdate();
            }
        }
Exemplo n.º 3
0
        private void watchListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            PageListViewItem selectedItem = watchListView.SelectedItems.Count > 0 ? (PageListViewItem)watchListView.SelectedItems[0] : null;
            if (selectedItem != null)
            {
                string page = selectedItem.SubItems[2].Text;
                watchListEditsView.BeginUpdate();
                watchListEditsView.Items.Clear();

                using (SQLiteCommand command = new SQLiteCommand(_connection))
                {
                    SQLiteParameter pageValue = new SQLiteParameter("@page");
                    pageValue.Value = selectedItem.Page;
                    command.Parameters.Add(pageValue);
                    SQLiteParameter namespaceValue = new SQLiteParameter("@namespace");
                    namespaceValue.Value = selectedItem.Namespace;
                    command.Parameters.Add(namespaceValue);
                    command.CommandText = @"SELECT timestamp, flags, size, user, summary, id, oldid
                                            FROM [edits]
                                            WHERE page=@page AND namespace=@namespace
                                            ORDER by timestamp DESC";
                    using (SQLiteDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            int size;
                            int.TryParse(reader[2].ToString(), out size);
                            int flags;
                            int.TryParse(reader[1].ToString(), out flags);

                            long diff;
                            long.TryParse(reader[5].ToString(), out diff);
                            long oldid;
                            long.TryParse(reader[6].ToString(), out oldid);

                            EditListViewItem item = new EditListViewItem(reader[0].ToString(),
                                WikiEdit.FlagsToString((EditFlags)flags),
                                size,
                                reader[3].ToString(),
                                reader[4].ToString(),
                                diff,
                                oldid);

                            watchListEditsView.Items.Add(item);
                        }
                        watchListEditsView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    }
                }
                watchListEditsView.EndUpdate();
            }
        }