Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfirmationDialogViewModel"/> class
        /// </summary>
        /// <param name="thingToDelete">The <see cref="Thing"/> to delete</param>
        public ConfirmationDialogViewModel(Thing thingToDelete)
        {
            this.YesCommand = ReactiveCommand.Create();
            this.YesCommand.Subscribe(_ => this.ExecuteYesCommand());

            this.NoCommand = ReactiveCommand.Create();
            this.NoCommand.Subscribe(_ => this.ExecuteNoCommand());

            var converter = new CamelCaseToSpaceConverter();

            this.DeletedThingText = (string)converter.Convert(thingToDelete.ClassKind, null, null, null);
        }
Example #2
0
        /// <summary>
        /// Set Layout of the DialogWindow
        /// </summary>
        /// <param name="window">
        /// The window that is created to hold this dialog.
        /// </param>
        /// <param name="thing">
        /// The thing that this dialog represents.
        /// </param>
        /// <param name="dialogKind">
        /// The kind of dialog being created.
        /// </param>
        private void SetDialogProperties(Window window, Thing thing, ThingDialogKind dialogKind)
        {
            ThemeManager.SetThemeName(window, "Seven");
            window.SizeToContent         = SizeToContent.WidthAndHeight;
            window.WindowStyle           = WindowStyle.SingleBorderWindow;
            window.Background            = Brushes.AliceBlue;
            window.ResizeMode            = ResizeMode.NoResize;
            window.ShowInTaskbar         = false;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.WindowState           = WindowState.Normal;

            if (thing != null)
            {
                var titlePrefix = string.Empty;

                switch (dialogKind)
                {
                case ThingDialogKind.Create:
                    titlePrefix = "Create";
                    break;

                case ThingDialogKind.Inspect:
                    titlePrefix = "Inspect";
                    break;

                case ThingDialogKind.Update:
                    titlePrefix = "Edit";
                    break;

                default:
                    titlePrefix = string.Empty;
                    break;
                }

                var typename = new CamelCaseToSpaceConverter().Convert(thing.ClassKind, null, null, null);
                window.Title = $"{titlePrefix} {typename}";
            }
        }
Example #3
0
 public void SetUp()
 {
     this.converter = new CamelCaseToSpaceConverter();
 }
Example #4
0
        /// <summary>
        /// Converts the <see cref="ClassKind"/> into a split string and preprends and appends <![CDATA[<< >>]]>
        /// </summary>
        /// <param name="value">An instance of an object which needs to be converted.</param>
        /// <param name="targetType">The parameter is not used.</param>
        /// <param name="parameter">The parameter is not used.</param>
        /// <param name="culture">The parameter is not used.</param>
        /// <returns>
        /// A split string preprended and appended with <![CDATA[<< >>]]>
        /// </returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var converter = new CamelCaseToSpaceConverter();

            return($"<<{converter.Convert(value, targetType, parameter, culture)}>>");
        }