Ejemplo n.º 1
0
 internal override DialogScreenResult ProcessInvocation <T>(
     DialogServiceInvocation invocation,
     IScreenFactory <T> screen
     )
 {
     return(_dialogResult);
 }
Ejemplo n.º 2
0
        DialogScreenResult IDialogService.ShowDialog(IScreenFactory <IScreenBase> screen, IScreenBase parent, string title)
        {
            var invocation = new DialogServiceInvocation(DialogServiceMethod.OpenDialog);

            invocation.Caption.SetValue(title);
            invocation.Parent.SetValue(parent);
            return(DequeueResponder().ProcessScreenDialogInvocation(invocation, screen));
        }
Ejemplo n.º 3
0
 internal virtual bool ProcessMessageBoxInvocationCore(
     DialogServiceInvocation invocation,
     out CustomDialogResult result
     )
 {
     result = CustomDialogResult.None;
     return(false);
 }
Ejemplo n.º 4
0
        bool IDialogService.ShowFolderBrowseDialog(IScreenBase parent, out string selectedPath, string message, Environment.SpecialFolder?specialFolder)
        {
            var invocation = new DialogServiceInvocation(DialogServiceMethod.ShowOpenFileDialog);

            invocation.Message.SetValue(message);
            invocation.Parent.SetValue(parent);

            return(DequeueResponder().ProcessFolderDialogInvocation(invocation, out selectedPath));
        }
Ejemplo n.º 5
0
        private CustomDialogResult ProcessMessageBoxInvocation(DialogServiceMethod type, string message, string caption)
        {
            var invocation = new DialogServiceInvocation(type);

            invocation.Message.SetValue(message);
            invocation.Caption.SetValue(caption);

            return(DequeueResponder().ProcessMessageBoxInvocation(invocation));
        }
Ejemplo n.º 6
0
 internal virtual bool ProcessScreenDialogInvocationCore <TScreen>(
     DialogServiceInvocation invocation,
     IScreenFactory <TScreen> screen,
     out DialogScreenResult result
     ) where TScreen : IScreenBase
 {
     result = null;
     return(false);
 }
Ejemplo n.º 7
0
        internal override bool ProcessMessageBoxInvocationCore(DialogServiceInvocation invocation, out CustomDialogResult result)
        {
            result = DialogResult;

            return
                (ExpectedInvocation.Method == invocation.Method &&
                 ExpectedInvocation.Caption.Matches(invocation.Caption) &&
                 ExpectedInvocation.Message.Matches(invocation.Message));
        }
Ejemplo n.º 8
0
 internal virtual bool ProcessFolderDialogInvocationCore(
     DialogServiceInvocation invocation,
     out string selectedPath,
     out bool result
     )
 {
     selectedPath = null;
     result       = false;
     return(false);
 }
Ejemplo n.º 9
0
 internal virtual bool ProcessFileDialogInvocationCore(
     DialogServiceInvocation invocation,
     out string filename,
     out bool result
     )
 {
     filename = null;
     result   = false;
     return(false);
 }
Ejemplo n.º 10
0
        bool IDialogService.ShowOpenFileDialog(IScreenBase parent, out string fileName, string filter, string initialDirectory, IEnumerable <string> customPlaces)
        {
            var invocation = new DialogServiceInvocation(DialogServiceMethod.ShowOpenFileDialog);

            invocation.Filter.SetValue(filter);
            invocation.InitialDirectory.SetValue(initialDirectory);
            invocation.Parent.SetValue(parent);

            return(DequeueResponder().ProcessFileDialogInvocation(invocation, out fileName));
        }
Ejemplo n.º 11
0
        internal override bool ProcessFolderDialogInvocationCore(
            DialogServiceInvocation invocation,
            out string selectedPath,
            out bool result
            )
        {
            selectedPath = _selectedPath;
            result       = DialogResult;

            return
                (ExpectedInvocation.Method == invocation.Method &&
                 ExpectedInvocation.Message.Matches(invocation.Message));
        }
Ejemplo n.º 12
0
        internal CustomDialogResult ProcessMessageBoxInvocation(
            DialogServiceInvocation invocation
            )
        {
            CustomDialogResult dialogResult;

            if (!ProcessMessageBoxInvocationCore(invocation, out dialogResult))
            {
                ThrowAssertionException(invocation);
            }

            return(dialogResult);
        }
Ejemplo n.º 13
0
        internal override bool ProcessFileDialogInvocationCore(
            DialogServiceInvocation invocation,
            out string fileName,
            out bool result
            )
        {
            fileName = _fileName;
            result   = DialogResult;

            return
                (ExpectedInvocation.Method == invocation.Method &&
                 ExpectedInvocation.InitialDirectory.Matches(invocation.InitialDirectory) &&
                 ExpectedInvocation.Filter.Matches(invocation.Filter));
        }
Ejemplo n.º 14
0
        internal bool ProcessFileDialogInvocation(
            DialogServiceInvocation invocation,
            out string filename
            )
        {
            bool dialogResult;

            if (!ProcessFileDialogInvocationCore(invocation, out filename, out dialogResult))
            {
                ThrowAssertionException(invocation);
            }

            return(dialogResult);
        }
Ejemplo n.º 15
0
        internal DialogScreenResult ProcessScreenDialogInvocation <TScreen>(
            DialogServiceInvocation invocation,
            IScreenFactory <TScreen> screen
            ) where TScreen : IScreenBase
        {
            DialogScreenResult dialogResult;

            if (!ProcessScreenDialogInvocationCore(invocation, screen, out dialogResult))
            {
                ThrowAssertionException(invocation);
            }

            return(dialogResult);
        }
Ejemplo n.º 16
0
        internal bool ProcessFolderDialogInvocation(
            DialogServiceInvocation invocation,
            out string selectedPath
            )
        {
            bool dialogResult;

            if (!ProcessFolderDialogInvocationCore(invocation, out selectedPath, out dialogResult))
            {
                ThrowAssertionException(invocation);
            }

            return(dialogResult);
        }
Ejemplo n.º 17
0
        internal override bool ProcessScreenDialogInvocationCore <T>(
            DialogServiceInvocation invocation,
            IScreenFactory <T> screen,
            out DialogScreenResult result
            )
        {
            result = null;

            bool match =
                ExpectedInvocation.Method == invocation.Method &&
                ExpectedInvocation.Caption.Matches(invocation.Caption) &&
                ExpectedInvocation.Parent.Matches(invocation.Parent);

            if (match)
            {
                result = ProcessInvocation(invocation, screen);
            }

            return(match);
        }
Ejemplo n.º 18
0
 internal abstract DialogScreenResult ProcessInvocation <T>(
     DialogServiceInvocation invocation,
     IScreenFactory <T> screen
     ) where T : IScreenBase;
Ejemplo n.º 19
0
 private void ThrowAssertionException(
     DialogServiceInvocation actualInvocation
     )
 {
     throw new ArgumentException();
 }
Ejemplo n.º 20
0
 internal ResponderBase(DialogServiceMethod method)
 {
     ExpectedInvocation = new DialogServiceInvocation(method);
 }