Ejemplo n.º 1
0
 private void SetLoading(bool loading)
 {
     if (loading)
     {
         _waitingDialog.Show();
     }
     else
     {
         _waitingDialog.Close();
     }
 }
Ejemplo n.º 2
0
        private WaitingDialog ProcessTask(Action action, Action completeAction, string title, string message)
        {
            ButtonsEnabled = false;
            var dialog = new WaitingDialog();

            dialog.OnClose += (o, result) => {
                ButtonsEnabled = true;
                completeAction();
                dialog.Dispose();
            };
            dialog.Show(DialogPlaceHolder, action, title, message);
            return(dialog);
        }
Ejemplo n.º 3
0
        private async void pi_del_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (null == this.grid_data.SelectedItem)
            {
                return;
            }
            var data = this.grid_data.SelectedItem as AirwayEntity;

            SAssert.MustTrue(null != data, string.Format("绑定数据异常!"));

            var promptResult = MessageBox.Show(string.Format("确认删除记录?"), "操作确认", MessageBoxButton.OKCancel);

            if (promptResult == MessageBoxResult.OK)
            {
                WaitingDialog.Show();

                // 删除记录
                await NHttpClientDAL.GetAsync(string.Format("api/DelAirwayInfo/${0}", data.Fid),
                                              new HttpResponseHandler(this.CommOpResponseCommHandler <BaseOpResult>));
            }
        }
Ejemplo n.º 4
0
        private void Button_Save_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("確定完成修改並儲存?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Information) == MessageBoxResult.OK)
            {
                try
                {
                    WaitingDialog waitingDialog = new WaitingDialog();
                    Thread        thread        = new Thread(() =>
                    {
                        waitingDialog         = new WaitingDialog();
                        waitingDialog.WText   = "請稍後";
                        waitingDialog.WDetail = "影像儲存中...";
                        waitingDialog.Show();

                        System.Windows.Threading.Dispatcher.Run();
                    });
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.IsBackground = true;
                    thread.Start();

                    BitmapImage saveBitmapImage = new CreateBitmapImage().BitmapImageOriginal(ImageInfo.Image_FullPath);

                    double pw = saveBitmapImage.PixelWidth;
                    double ph = saveBitmapImage.PixelHeight;

                    double rw = rectangle.Width;
                    double rh = rectangle.Height;

                    double bw = border.Width;
                    double bh = border.Height;

                    //image 控制項P1
                    Point sourceP1 = new Point(Canvas.GetLeft(rectangle) - Canvas.GetLeft(border), Canvas.GetTop(rectangle) - Canvas.GetTop(border));

                    //原始圖片比例的rectangle
                    double oriWidth  = pw * (rw / bw);
                    double oriHeight = ph * (rh / bh);

                    //比例
                    double rectangleRatioX = sourceP1.X / bw;
                    double rectangleRatioY = sourceP1.Y / bh;
                    //原始圖片的P1
                    Point oriStartPoint = new Point(pw * rectangleRatioX, ph * rectangleRatioY);

                    DealNewImage(saveBitmapImage, rotateAngle, (int)oriStartPoint.X, (int)oriStartPoint.Y, (int)oriWidth, (int)oriHeight, ImageInfo.Image_FullPath);

                    waitingDialog.Dispatcher.BeginInvoke(new Action(() => {
                        System.Windows.Threading.Dispatcher.CurrentDispatcher.InvokeShutdown();
                        waitingDialog.Close();
                    }));
                    thread.Abort();

                    //儲存完馬上重載修改後的圖片
                    ImageInfo.BitmapImage = new CreateBitmapImage().BitmapImageShow(ImageInfo.Image_FullPath, 800);

                    MessageBox.Show("儲存成功", "提示", MessageBoxButton.OK);

                    SetImageDefault(ImageInfo.Image_FullPath);

                    GC.Collect();
                }
                catch (Exception ex)
                {
                    ErrorLog.ErrorMessageOutput(ex.ToString());
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 发起Http Post请求
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="control"></param>
 /// <param name="url"></param>
 /// <param name="param"></param>
 /// <param name="callback"></param>
 /// <param name="context"></param>
 public static async void PostAsync <T>(this Control control, string url, T param = null, HttpResponseHandler callback = null, object context = null)
     where T : class, new()
 {
     WaitingDialog.Show();
     await NHttpClientDAL.PostAsync(url, param, callback);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 发起Http Get请求
 /// </summary>
 /// <param name="control"></param>
 /// <param name="url"></param>
 /// <param name="callback"></param>
 /// <param name="context"></param>
 /// <returns></returns>
 public static async Task GetAsync(this Control control, string url, HttpResponseHandler callback = null, object context = null)
 {
     WaitingDialog.Show();
     await NHttpClientDAL.GetAsync(url, callback);
 }