Beispiel #1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            int         i       = gridView1.GetSelectedRows().FirstOrDefault();
            tblLink     link    = gridView1.GetRow(i) as tblLink;
            frmEditLink frmedit = new frmEditLink();

            frmedit.Link = link;
            frmedit.Show();
        }
Beispiel #2
0
        private async void gridView1_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
        {
            tblLink link = e.Row as tblLink;

            if (link == null)
            {
                return;
            }
            link.Type = UserManagement.UserSession.Type;
            if (link.Id > 0)
            {
                await rpLink.Update(link);
            }
            else
            {
                await rpLink.Insert(link);
            }
        }
Beispiel #3
0
 private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
 {
     if (e.Column.FieldName == "Link")
     {
         int     i    = gridView1.GetSelectedRows().FirstOrDefault();
         tblLink link = gridView1.GetRow(i) as tblLink;
         if (string.IsNullOrEmpty(link.Link))
         {
             return;
         }
         if (link.Link.Length > 10 && link.Link.Substring(0, 10).Contains("http"))
         {
             Process.Start(@"CocCoc.exe", "--incognito " + link.Link);
         }
         else
         {
             Process.Start(@"CocCoc.exe", "--incognito " + "https://www.google.com/search?q=" + Uri.EscapeDataString(link.Link));
         }
     }
 }
Beispiel #4
0
        private async void btnRemove_Click(object sender, EventArgs e)
        {
            TabPage tab = materialTabControl1.SelectedTab;

            if (tab == null)
            {
                return;
            }
            if (tab.Text == "Link")
            {
                int     i    = gridView1.GetSelectedRows().FirstOrDefault();
                tblLink link = gridView1.GetRow(i) as tblLink;
                if (link == null)
                {
                    return;
                }
                await rpLink.DeleteById(link.Id);

                gridView1.DeleteRow(i);
                return;
            }

            if (tab.Text == "Downloaded")
            {
                string       fileName = string.Empty;
                ListViewItem item     = lstViewContent.SelectedItems[0];
                if (item == null)
                {
                    return;
                }
                if (item.Tag == null)
                {
                    item.Tag = "";
                }
                fileName = Path.GetFileName(item.Tag.ToString());
                await rpMovie.DeleteByFullPath(fileName);

                lstViewContent.Items.Remove(item);
                File.Delete(fileName);
            }
        }
Beispiel #5
0
 public frmEditLink()
 {
     InitializeComponent();
     Link = new tblLink();
     db   = null;
 }