private void Button_Click()
        {
            var dlg = new CommonOpenFileDialog();

            dlg.Title            = "My Title";
            dlg.IsFolderPicker   = true;
            dlg.InitialDirectory = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);

            dlg.AddToMostRecentlyUsedList = false;
            dlg.AllowNonFileSystemItems   = false;
            dlg.DefaultDirectory          = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
            dlg.EnsureFileExists          = true;
            dlg.EnsurePathExists          = true;
            dlg.EnsureReadOnly            = false;
            dlg.EnsureValidNames          = true;
            dlg.Multiselect    = false;
            dlg.ShowPlacesList = true;
            dlg.IsFolderPicker = true;

            if (dlg.ShowDialog() == CommonFileDialogResult.Ok)
            {
                var folder = dlg.FileName;
                // Do something with selected folder string
                UserPath path = new UserPath();
                path.SelectedPath = folder;
                if (App.startupArgument == App.StartupArgument.RenderPath)
                {
                    if (IsUnique(folder))
                    {
                        string json = JsonConvert.SerializeObject(path);
                        System.IO.File.WriteAllText(GetPathRenderPath() + "\\" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".json", json);
                        //MessageBoxResult result = MessageBox.Show(folder, "Your choice");
                        //if (result == MessageBoxResult.OK || result == MessageBoxResult.Cancel)
                        //{
                        //    System.Windows.Application.Current.Shutdown();
                        //}
                        System.Windows.Application.Current.Shutdown();
                    }
                }

                if (App.startupArgument == App.StartupArgument.CollectPath)
                {
                    ModifyJsonOnId(folder);
                    System.Windows.Application.Current.Shutdown();
                }
            }
        }
        private bool IsUnique(string path)
        {
            bool isUnique = true;

            foreach (var VARIABLE in Directory.GetFiles(GetPathRenderPath(), "*.json"))
            {
                UserPath userPath     = JsonConvert.DeserializeObject <UserPath>(File.ReadAllText(VARIABLE));
                string   pathFromJson = userPath.SelectedPath;


                if (pathFromJson == path)
                {
                    isUnique = false;
                }
            }

            return(isUnique);
        }