TextEntryController.cs

Craig Presti, 08/23/2010 02:43 pm

Download (1.1 kB)

 
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Windows.Interop;
6
using System.Threading;
7
using Plugin.Dialog.Views;
8
using Plugin.Dialog.Model;
9
10
namespace Plugin.Dialog.Controllers
11
{
12
    class TextEntryController : IDialogController
13
    {
14
        private BasicDialogView _Dialog;       
15
16
        public System.Windows.Window CreateWindow(IntPtr ownerHandle)
17
        {
18
            _Dialog = new BasicDialogView();            
19
20
            var interopHelper = new WindowInteropHelper(_Dialog)
21
            {
22
                Owner = ownerHandle
23
            };
24
25
            return _Dialog;
26
        }
27
28
        public IDialogResult ShowDialog(IDialog dialogSettings, double left, double top)
29
        {   
30
            _Dialog.Left = left;
31
            _Dialog.Top = top;
32
            _Dialog.Title = dialogSettings.Title;
33
            _Dialog.TextValue = (dialogSettings as TextBoxDialog).Text;
34
            _Dialog.Description = dialogSettings.Description;
35
            _Dialog.ShowDialog();
36
37
            return _Dialog.Result;            
38
        }
39
    }
40
}