Пример #1
0
        private DlgInput(string message, string title, Image image, string presetText)
        {
            InitializeComponent();

            if (title != null)
            {
                Title = title;
            }
            if (image != null)
            {
                Icon = image.Source;
            }
            if (presetText != null)
            {
                TextBoxInput.Text = presetText;
            }
            else
            {
                TextBoxInput.Text = "";
            }
            TextMessage.Text            = message;
            TextBoxInput.SelectionStart = TextBoxInput.Text.Length;
            TextBoxInput.Focus();

            // We need to measure the ActualHeight of TextBoxInput,
            // because it reads 0.0 if it's not set, unlesse Arrage is called.
            // And it's not set on purpose to use system default.
            TextBoxInput.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            TextBoxInput.Arrange(new Rect(TextBoxInput.DesiredSize));

            DlgHelper.Initialize(this);
            DlgHelper.CalcNeededSize(this, TextMessage, ButtonOk.Height + TextBoxInput.ActualHeight);
        }
Пример #2
0
        private DlgConfirmation(string message, string title, Image image)
        {
            InitializeComponent();

            if (title != null)
            {
                Title = title;
            }
            if (image != null)
            {
                Icon = image.Source;
            }
            TextMessage.Text = message;

            DlgHelper.Initialize(this);
            DlgHelper.CalcNeededSize(this, TextMessage, ButtonOk.Height);
        }