Beispiel #1
0
        private void UpdateCalculated()
        {
            var nameHasChanged = !Name.EqualsIgnoreCase(_connection?.Name);

            IsRenamed  = nameHasChanged && _connection?.Name != null;
            HasChanges = nameHasChanged ||
                         !Path.EqualsIgnoreCase(_connection?.Path) ||
                         !RCommandLineArguments.EqualsIgnoreCase(_connection?.RCommandLineArguments);

            IsNameValid = IsValidConnectionName(Name);
            if (!IsNameValid)
            {
                NameTextBoxTooltip = string.IsNullOrEmpty(Name)
                    ? Resources.ConnectionManager_ShouldHaveName
                    : Resources.ConnectionManager_InvalidName;
            }
            else
            {
                NameTextBoxTooltip = null;
            }

            Uri uri;

            IsPathValid = IsValidConnectionUrl(Path, out uri);
            if (!IsPathValid)
            {
                PathTextBoxTooltip = string.IsNullOrEmpty(Path)
                    ? Resources.ConnectionManager_ShouldHavePath
                    : Resources.ConnectionManager_InvalidPath;
            }
            else
            {
                PathTextBoxTooltip = null;
            }

            IsValid = IsNameValid && IsPathValid;
            if (IsValid)
            {
                SaveButtonTooltip = Resources.ConnectionManager_Save;
            }
            else
            {
                SaveButtonTooltip = !IsNameValid ? NameTextBoxTooltip : PathTextBoxTooltip;
            }

            if (IsValid && uri != null)
            {
                IsRemote = !(uri.IsAbsoluteUri && uri.IsFile);
            }
            else
            {
                IsRemote = true;
            }
        }
Beispiel #2
0
        private void UpdateCalculated()
        {
            HasChanges = !Name.EqualsIgnoreCase(_connection?.Name) ||
                         !Path.EqualsIgnoreCase(_connection?.Path) ||
                         !RCommandLineArguments.EqualsIgnoreCase(_connection?.RCommandLineArguments);

            Uri uri = null;

            CanConnect = !string.IsNullOrEmpty(Name) && Uri.TryCreate(Path, UriKind.Absolute, out uri);

            IsRemote = !(uri?.IsFile ?? true);
        }