Esempio n. 1
0
        private void CreateNewTag(string tagString, IList songs)
        {
            var categoryMatch = _parenRegex.Match(tagString);
            var catName       = categoryMatch.Success
                ? categoryMatch.Groups[1].Captures[0].Value.Trim()
                : string.Empty;

            var tagNameMatch = _tagPrefixRegex.Match(tagString);
            var tagName      = tagNameMatch.Success
                ? tagNameMatch.Groups[1].Captures[0].Value.Trim()
                : tagString.Trim();

            var tagEditorWindow = new CreateNewTagWindow();
            var tagVm           = new CreateNewTagVm(tagName, catName)
            {
                CloseAction = tagEditorWindow.Close
            };

            tagEditorWindow.DataContext = tagVm;
            tagEditorWindow.ShowDialog();
            if (tagVm.CreateTagSuccessful)
            {
                AddTag(tagVm.NewTag, songs);
            }
        }
    public static void Show(Func <string, bool> newNameValidator, Action <string> onNameSelected)
    {
        if (_window == null)
        {
            _window = CreateInstance(typeof(CreateNewTagWindow)) as CreateNewTagWindow;
        }

        Debug.Assert(_window != null, nameof(_window) + " != null");
        _window.titleContent.text = "New Tag";
        _window.Focus();
        _window._newNameValidator = newNameValidator;
        _window.ShowUtility();
        _window._onDone = onNameSelected;
    }
Esempio n. 3
0
 private void GoToCreateNewTag()
 {
     CreateNewTagWindow.Show(IsValidTagName, OnTagNameSelected);
 }