Beispiel #1
0
        private void AddFileItems(string[] files)
        {
            bool hasNull = false;

            foreach (var path in files)
            {
                if (System.IO.File.Exists(path))
                {
                    if (IsFileInUse(path))
                    {
                        AppData.MainMV.TipMessage = $"[{System.IO.Path.GetFileName(path)}]文件已被占用,无法进行传输! ";
                        continue;
                    }
                    FileInfo fileInfo = new System.IO.FileInfo(path);
                    if (fileInfo.Length == 0)
                    {
                        hasNull = true;
                        continue;
                    }
                    else
                    {
                        FilePackage file = new FilePackage()
                        {
                            FileInfo = fileInfo,
                            Uid      = ViewModels.AppData.FlagFile + path
                        };
                        this.AddUI(file);
                    }
                }
            }

            if (hasNull)
            {
                ViewModels.AppData.MainMV.TipMessage = "文件大小不能为空!";
            }
        }
Beispiel #2
0
        private static void OnFileInfoPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FilePackage target = d as FilePackage;

            target.LoadFile();
        }