void da_Fls_FtpMethodCompleted(object sender, FtpMethodCompletedEventArgs e) { this.loadingWindow.Close(); if (e.Result == null || e.Result.Contains("Err") == true) { MessageBox.Show(e.Result, "连接到网络错误", MessageBoxButton.OK); return; } this.OKButton.Visibility = System.Windows.Visibility.Visible; this.canvas1.Children.Clear(); string[] strs = e.Result.Split('@'); int colIdx = 0; int rowIdx = 0; foreach (string s in strs) { if (string.IsNullOrEmpty(s)) { continue; } colIdx++; if (colIdx == 5) { rowIdx++; colIdx = 0; } TempleteFile tempFile = new TempleteFile(); tempFile.BindText(s); tempFile.SetValue(Canvas.LeftProperty, (double)100 * colIdx); tempFile.SetValue(Canvas.TopProperty, (double)100 * rowIdx); tempFile.Tag = s; MouseDragElementBehavior mdeImg = new MouseDragElementBehavior(); Interaction.GetBehaviors(tempFile).Add(mdeImg); this.canvas1.Children.Add(tempFile); tempFile.MouseLeftButtonDown += new MouseButtonEventHandler(tempFile_MouseLeftButtonDown); } }
void tempFile_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if ((DateTime.Now.Subtract(_lastTime).TotalMilliseconds) < 300) { TempleteFile fl = sender as TempleteFile; if (fl != null) { if (MessageBox.Show("您确定要安装[" + fl.Tag.ToString() + "]模板吗?", "确认", MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } FF.CCFormSoapClient loadTemplete = Glo.GetCCFormSoapClientServiceInstance(); loadTemplete.FtpMethodAsync("LoadTempleteFile", fl.Tag.ToString(), Glo.FK_MapData, this.PathOfFtpCurrDir); loadTemplete.FtpMethodCompleted += new EventHandler <FtpMethodCompletedEventArgs>(loadTemplete_FtpMethodCompleted); this.loadingWindow.Title = "正在装载模板请稍候。。。"; this.loadingWindow.Show(); } } _lastTime = DateTime.Now; }