示例#1
0
        public static void CheckSongPathExist()
        {
            Mouse.OverrideCursor = Cursors.Wait;

            List <string> notValidPath = new List <string>();

            Views.MyMessageBox messageBox = new Views.MyMessageBox();

            var pathlist = GetSetData.GetSongPathList();

            bool found = true;

            if (pathlist != null)
            {
                foreach (var p in pathlist)
                {
                    if (!Directory.Exists(p))
                    {
                        notValidPath.Add(p);
                        found = false;
                    }
                }
            }
            else
            {
                found = false;
                messageBox.MMessage = $"Pathlist is empty!";
            }

            if (found == false)
            {
                messageBox.MMessage = $"This path was not found!\n{String.Join(Environment.NewLine, notValidPath)}";
            }
            else
            {
                messageBox.MMessage = $"All path are valid.";
            }

            Mouse.OverrideCursor = Cursors.Arrow;

            messageBox.MTitle = "Check Song Path";
            messageBox.ShowDialog();
        }
示例#2
0
        public static bool CheckSongPathExistAsync()
        {
            List <string> notValidPath = new List <string>();

            var pathlist = GetSetData.GetSongPathList();

            bool found = true;

            if (pathlist != null)
            {
                foreach (var p in pathlist)
                {
                    Debug.Print($"path={p}");
                    if (!Directory.Exists(p))
                    {
                        Debug.Print(p);
                        found = false;
                        break;
                    }
                }
            }
            else
            {
                found = false;
            }

            if (found == false)
            {
                Views.MyMessageBox messageBox = new Views.MyMessageBox();
                messageBox.MTitle   = "Check Song Path";
                messageBox.MMessage = "No song path found!\n\nExit Application.";
                var result = messageBox.ShowDialog();
            }

            return(found);
        }