Exemplo n.º 1
0
        void da_FtpMethodCompleted(object sender, FtpMethodCompletedEventArgs e)
        {
            this.loadingWindow.Close();
            if (e.Result == null || e.Result.Contains("Err") == true)
            {
                MessageBox.Show(e.Result, "连接到网络错误", MessageBoxButton.OK);
                return;
            }

            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;
                }
                Dir dir = new Dir();
                dir.BindText(s);
                dir.SetValue(Canvas.LeftProperty, (double)100 * colIdx);
                dir.SetValue(Canvas.TopProperty, (double)100 * rowIdx);
                dir.Tag = s;

                MouseDragElementBehavior mdeImg = new MouseDragElementBehavior();
                Interaction.GetBehaviors(dir).Add(mdeImg);
                this.canvas1.Children.Add(dir);
                dir.MouseLeftButtonDown += new MouseButtonEventHandler(dir_MouseLeftButtonDown);
            }
        }