Ejemplo n.º 1
0
        public static ConnectionString ShowDatabaseConnection()
        {
            var vm   = new MessageDatabaseConnectionStringViewModel();
            var view = new Views.MessageBoxDatabaseConnectionStringView();

            view.DataContext = vm;

            view.ShowDialog();

            if (vm.MessageResult == MessageResult.OK)
            {
                return(new ConnectionString(vm.DataSource, vm.Database, vm.UserId, vm.Password));
            }

            return(null);
        }
Ejemplo n.º 2
0
        //public static List<T> ShowWithOptions<T>(string messageBoxText, System.Collections.IList dataSource) where T : IMessageWithOption
        //{
        //    return ShowWithOptions<T>(null, messageBoxText, string.Empty, MessageStyle.Primary, dataSource, MessageWithOptionControlStyle.RadioButtonsList);
        //}

        public static MessageResult ShowDatabaseConnection(Func <ConnectionString, bool> action)
        {
            var vm   = new MessageDatabaseConnectionStringViewModel();
            var view = new Views.MessageBoxDatabaseConnectionStringView();

            view.DataContext = vm;

            view.ShowDialog();

            if (vm.MessageResult == MessageResult.OK)
            {
                if (!action(new ConnectionString(vm.DataSource, vm.Database, vm.UserId, vm.Password)))
                {
                    vm.MessageResult = MessageResult.Cancel;
                }
            }

            return(vm.MessageResult);
        }