Exemple #1
0
        private void OpenExcle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title            = "选择文件";
            openFileDialog.Filter           = "xls,xlsx文件|*.xls;*.xlsx";
            openFileDialog.FileName         = string.Empty;
            openFileDialog.FilterIndex      = 1;
            openFileDialog.RestoreDirectory = true;
            openFileDialog.DefaultExt       = "xls";
            if (openFileDialog.ShowDialog() == true)
            {
                ExcelDataController edc = new ExcelDataController();
                OpenDelegate        od  = new OpenDelegate(OpenExcel);
                loading.Visibility = Visibility.Visible;
                IAsyncResult asyncResult = od.BeginInvoke(openFileDialog.FileName, OpenExcelCompleted, od);
                //List<DealListEntity> DLEL = od.EndInvoke(asyncResult);
                //loading.Visibility = Visibility.Collapsed;
                //DBSyncController.Handler().DealListAdd(DLEL);
                //DBDataThreadController.DBDataThreadControllerHandler(DBSyncController.Handler()).DealListAdd(DLEL);
                //StockStateBoxController.Handler().StockBoxInit();
            }
            else
            {
                return;
            }
        }
        protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
        {
            OpenDelegate d = new OpenDelegate(this.Open);

            return(d.BeginInvoke(timeout, callback, state));
        }
Exemple #3
0
 private void OpenExcle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Title = "选择文件";
     openFileDialog.Filter = "xls,xlsx文件|*.xls;*.xlsx";
     openFileDialog.FileName = string.Empty;
     openFileDialog.FilterIndex = 1;
     openFileDialog.RestoreDirectory = true;
     openFileDialog.DefaultExt = "xls";
     if (openFileDialog.ShowDialog() == true)
     {
         ExcelDataController edc = new ExcelDataController();
         OpenDelegate od = new OpenDelegate(OpenExcel);
         loading.Visibility = Visibility.Visible;
         IAsyncResult asyncResult = od.BeginInvoke(openFileDialog.FileName, OpenExcelCompleted, od);
         //List<DealListEntity> DLEL = od.EndInvoke(asyncResult);
         //loading.Visibility = Visibility.Collapsed;
         //DBSyncController.Handler().DealListAdd(DLEL);
         //DBDataThreadController.DBDataThreadControllerHandler(DBSyncController.Handler()).DealListAdd(DLEL);
         //StockStateBoxController.Handler().StockBoxInit();
     }
     else
     {
         return;
     }
 }