示例#1
0
        /// <summary>
        /// 右键菜单展开事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnContextMenuOpen(object sender, ContextMenuEventArgs e)
        {
            XamlUtil.SelectRow(PasswordDataGrid, e);
            var selected = PasswordDataGrid.SelectedItem;

            if (null == selected)
            {
                e.Handled = true;
            }
        }
示例#2
0
        /// <summary>
        /// 右键删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnClickContextMenuDelete(object sender, MouseButtonEventArgs e)
        {
            XamlUtil.SelectRow(DnsRecordDataGrid, e);
            var selected = DnsRecordDataGrid.SelectedItem as DnsRecord;

            if (null == selected)
            {
                return;
            }
            var result = new ConfirmDialog(AlertLevel.WARN, string.Format((string)Application.Current.FindResource("DeleteConfirm"), selected.Name)).ShowDialog();

            if (result.GetValueOrDefault())
            {
                mTenCloudDns.DelDNSRecord(Convert.ToString(selected.id), response =>
                {
                    var resultData = response.Data;
                    LoadDnsRecord();
                });
            }
        }
示例#3
0
        /// <summary>
        /// 同步规则删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnSyncConfigItemMouseRightClick(object sender, MouseButtonEventArgs e)
        {
            XamlUtil.SelectRow(SyncPathDataGrid, e);
            var selected = SyncPathDataGrid.SelectedItem as SyncConfigViewModel;

            if (null == selected)
            {
                return;
            }
            //删除对话框
            var result = new ConfirmDialog(AlertLevel.WARN, string.Format((string)Application.Current.FindResource("DeleteConfirm"), string.Format("{0}", selected.PcPath))).ShowDialog();

            if (result.GetValueOrDefault())
            {
                SQLite.ExecuteNonQuery("DELETE FROM media_sync_config WHERE ID = @id", new List <SQLiteParameter> {
                    new SQLiteParameter("@id", selected.Id)
                });
                var vm = DataContext as SettingsViewModel;
                vm.SyncConfigs.Remove(selected);
                vm.CheckSyncConfigIsCheckedAll(true);
            }
        }