コード例 #1
0
        private async void btnDyn_Click(object sender, EventArgs e)
        {
            SimpleButton btn = (SimpleButton)sender;
            int dsID = Convert.ToInt32(btn.Tag);
            if (Classes.QueryLayout.ChekForEmptyPram(DataSourceList))
            {
                MsgDlg.Show("Please Fill All Paramters For Data Source: " + DataSourceList.DatasourceName, MsgDlg.MessageType.Info);
                return;
            }
            //Creating Excel Updatable Sheet
            Dictionary<string, object> Paramters = new Dictionary<string, object>();
            foreach (KeyValuePair<string, Control> ctrItem in DataSourceList.Controls)
            {
                if (ctrItem.Value.GetType() == typeof(DevExpress.XtraEditors.CheckedComboBoxEdit))
                    Paramters.Add(ctrItem.Key, ((TextEdit)ctrItem.Value).EditValue);
                else
                    Paramters.Add(ctrItem.Key, ((TextEdit)ctrItem.Value).Text);
            }

            DataSourceList.EDUButton.Enabled = false;
            DataSourceList.EDUCancelButton.Enabled = true;
            layoutControlGroupDatasource.Enabled = false;//Stop User Activity
            Application.DoEvents();
            try
            {
                DynNotify = new UpdateInfo(); DynNotify.AddItem(null);//Add Item To Kill Excel App
                Classes.msExcel.DynamicRefresh.xlDRJobManager DynJobManager = new Classes.msExcel.DynamicRefresh.xlDRJobManager();
                await DynJobManager.CreateDynamicWorkbookAsync(DataSourceList, Paramters, DynNotify);
            }
            catch { }

            RemoveProgressList(dsID.ToString());// Remove From Working List
            DataSourceList.EDUButton.Enabled = true;
            DataSourceList.EDUCancelButton.Enabled = false;
            layoutControlGroupDatasource.Enabled = true;//Stop User Activity
        }