Exemple #1
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += this.OnSuspending;

            connectionsVM = new ConnectionsViewModel();
        }
Exemple #2
0
 public ConnectionsPage()
 {
     model          = new ConnectionsViewModel(Navigation);
     BindingContext = model;
     InitializeComponent();
     Title = AppResources.ConnectionsPage_Title;
 }
 public MainViewModel(
     IUserDialogs userDialogs,
     INavigationService navigationService,
     IEventAggregator eventAggregator,
     IAgentProvider agentContextProvider,
     IWalletRecordService walletRecordService,
     ILifetimeScope lifetimeScope,
     ConnectionsViewModel connectionsViewModel,
     CredentialsViewModel credentialsViewModel,
     AccountViewModel accountViewModel,
     CreateInvitationViewModel createInvitationViewModel,
     ProofRequestsViewModel proofRequestsViewModel,
     ScanQrCodeViewModel scanQrCodeViewModel
     ) : base(nameof(MainViewModel), userDialogs, navigationService)
 {
     Connections           = connectionsViewModel;
     Credentials           = credentialsViewModel;
     Account               = accountViewModel;
     CreateInvitation      = createInvitationViewModel;
     ProofRequests         = proofRequestsViewModel;
     ScanQrCode            = scanQrCodeViewModel;
     _eventAggregator      = eventAggregator;
     _walletRecordService  = walletRecordService;
     _agentContextProvider = agentContextProvider;
     _lifetimeScope        = lifetimeScope;
     //for prompting dialog on connection events
     //WalletEventService.Init(navigationService);
 }
Exemple #4
0
        public IActionResult CreateConnection(ConnectionsViewModel model)
        {
            _configuration["ConnectionSelected"] = model.ConnectionSelected;

            InitializeContext();

            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult DisplayPossibilities()
        {
            ConnectionsViewModel connectionsViewModel = new ConnectionsViewModel();

            if (connectionsViewModel.Cities.Count == 0)
            {
                TempData["NoConnection"] = "Derzeit können wir Ihnen leider keine Verkehrsverbindugen anbieten";
                return(RedirectToAction("Index", "Home"));
            }
            return(View(connectionsViewModel));
        }
Exemple #6
0
        public async Task <IActionResult> SendProofRequestNameView()
        {
            var agentContext = await _agentProvider.GetContextAsync();

            var model = new ConnectionsViewModel
            {
                Connections = await _connectionService.ListAsync(agentContext)
            };

            return(View(model));
        }
Exemple #7
0
        private static void InitLocalisedContent()
        {
            Dictionary <string, string> entityTypes;
            string id;
            string logicalName;

#if DEBUG
            id                         = "C489707F-B5E2-E411-80D5-080027846324";
            logicalName                = "account";
            entityTypes                = new Dictionary <string, string>();
            entityTypes["account"]     = "name";
            entityTypes["contact"]     = "fullname";
            entityTypes["opportunity"] = "name";
#else
            entityTypes = PageEx.GetWebResourceData(); // The allowed lookup types for the connections - e.g. account, contact, opportunity. This must be passed as a data parameter to the webresource 'account=name&contact=fullname&opportunity=name
            id          = ParentPage.Data.Entity.GetId();
            logicalName = ParentPage.Data.Entity.GetEntityName();
#endif
            EntityReference parent = new EntityReference(new Guid(id), logicalName, null);
            vm = new ConnectionsViewModel(parent, entityTypes);
            // Bind Connections grid
            GridDataViewBinder contactGridDataBinder = new GridDataViewBinder();
            List <Column>      columns = GridDataViewBinder.ParseLayout(String.Format("{0},record1id,250,{1},record1roleid,250", ResourceStrings.ConnectTo, ResourceStrings.Role));

            // Role2Id Column
            XrmLookupEditor.BindColumn(columns[1], vm.RoleSearchCommand, "connectionroleid", "name", "");

            connectionsGrid = contactGridDataBinder.DataBindXrmGrid(vm.Connections, columns, "container", "pager", true, false);

            connectionsGrid.OnActiveCellChanged.Subscribe(delegate(EventData e, object data)
            {
                OnCellChangedEventData eventData = (OnCellChangedEventData)data;
                vm.SelectedConnection.SetValue((Connection)connectionsGrid.GetDataItem(eventData.Row));
            });

            // Let's not use a hover button because it get's n the way of the editable grid!
            //RowHoverPlugin rowButtons = new RowHoverPlugin("gridButtons");
            //connectionsGrid.RegisterPlugin(rowButtons);

            ViewBase.RegisterViewModel(vm);

            OverrideMetadata();

            jQuery.Window.Resize(OnResize);
            jQuery.OnDocumentReady(delegate()
            {
                OnResize(null);
                vm.Search();
            });
        }
        public static void TestCreateConnectionValidation(Assert assert)
        {
            assert.Expect(1);

            ConnectionsViewModel vm         = new ConnectionsViewModel(accounts[0].ToEntityReference(), null, 0, null);
            ObservableConnection connection = vm.ConnectionEdit.GetValue();

            connection.Record1Id.SetValue(accounts[1].ToEntityReference());

            // Check the validation doesn't allow us to save without the role
            bool isValid = ((IValidatedObservable)connection).IsValid();

            assert.Equal(false, isValid, "Validation Not Valid");
        }
 public MainViewModel(
     IUserDialogs userDialogs,
     INavigationService navigationService,
     ConnectionsViewModel connectionsViewModel,
     CredentialsViewModel credentialsViewModel,
     AccountViewModel accountViewModel,
     CreateInvitationViewModel createInvitationViewModel,
     ProofRequestsViewModel proofRequestsViewModel) : base(nameof(MainViewModel), userDialogs, navigationService)
 {
     Connections      = connectionsViewModel;
     Credentials      = credentialsViewModel;
     Account          = accountViewModel;
     CreateInvitation = createInvitationViewModel;
     ProofRequests    = proofRequestsViewModel;
 }
        public override Task OnConnected()
        {
            var    id   = Context.ConnectionId;
            string name = Context.User.Identity.Name;

            CurrentConnections.Add(id);
            Connections.Add(name);
            ConnectionsViewModel connectionsViewModels = new ConnectionsViewModel {
                ConnectionID = id, Name = name
            };

            ConnectionsViewModel.Add(connectionsViewModels);
            Clients.All.NewConnection(connectionsViewModels.Name);
            return(base.OnConnected());
        }
Exemple #11
0
        public MainWindow()
        {
            InitializeComponent();

            App.Current.DispatcherUnhandledException += App_DispatcherUnhandledException;

            OptionsViewModel     optionsViewModel     = new OptionsViewModel();
            MappingViewModel     mappingViewModel     = new MappingViewModel(plansTree);
            ConnectionsViewModel connectionsViewModel = new ConnectionsViewModel();

            gp_options.DataContext     = optionsViewModel;
            gp_copy.DataContext        = mappingViewModel;
            gp_connections.DataContext = connectionsViewModel;
            gp_settings.DataContext    = new SettingsViewModel(mappingViewModel, optionsViewModel);
        }
Exemple #12
0
 public MainViewModel(
     IUserDialogs userDialogs,
     INavigationService navigationService,
     ConnectionsViewModel connectionsViewModel,
     CredentialsViewModel credentialsViewModel,
     AccountViewModel accountViewModel
     ) : base(
         nameof(MainViewModel),
         userDialogs,
         navigationService
         )
 {
     Connections = connectionsViewModel;
     Credentials = credentialsViewModel;
     Account     = accountViewModel;
 }
Exemple #13
0
        public MainViewModel(
            IUserDialogs userDialogs,
            INavigationService navigationService,
            HomeViewModel homeViewModel,
            MessagesViewModel messagesViewModel,
            IAgentProvider agentContextProvider,
            ConnectionsViewModel connectionsViewModel,
            CredentialsViewModel credentialsViewModel,
            IEventAggregator eventAggregator,
            IProofService proofService,
            IProofAssembler proofAssembler,
            IWalletRecordService recordService,
            IRequestPresentationFiller requestPresentationFiller,
            AccountViewModel accountViewModel,
            ProofRequestsViewModel proofRequestsViewModel,
            CreateInvitationViewModel createInvitationViewModel
            ) : base(
                nameof(MainViewModel),
                userDialogs,
                navigationService
                )
        {
            Home                       = homeViewModel;
            Messages                   = messagesViewModel;
            Connections                = connectionsViewModel;
            Credentials                = credentialsViewModel;
            Account                    = accountViewModel;
            ProofRequests              = proofRequestsViewModel;
            CreateInvitation           = createInvitationViewModel;
            _eventAggregator           = eventAggregator;
            _proofService              = proofService;
            _recordService             = recordService;
            _agentContextProvider      = agentContextProvider;
            _requestPresentationFiller = requestPresentationFiller;
            _proofAssembler            = proofAssembler;
            MessagingCenter.Subscribe <object>(this, "ScanInvite", async(sender) =>
            {
                await ScanInvite();
            });

            _subscription = _eventAggregator.GetEventByType <ServiceMessageProcessingEvent>()
                            .Where(x => x.MessageType == MessageTypes.PresentProofNames.RequestPresentation || x.MessageType == "https://didcomm.org/present-proof/1.0/request-presentation")
                            .Subscribe(async x =>
            {
                await DisplayRequestPresentation(x.RecordId);
            });
        }
Exemple #14
0
 public MainViewModel(
     IUserDialogs userDialogs,
     INavigationService navigationService,
     ConnectionsViewModel connectionsViewModel,
     CredentialsViewModel credentialsViewModel,
     NotificationViewModel notificationViewModel,
     SettingViewModel settingViewModel,
     CloudWalletService cloudWalletService
     ) : base(
         nameof(MainViewModel),
         userDialogs,
         navigationService
         )
 {
     Connections         = connectionsViewModel;
     Credentials         = credentialsViewModel;
     Notification        = notificationViewModel;
     Setting             = settingViewModel;
     _cloudWalletService = cloudWalletService;
 }
        public static void TestCreateConnection(Assert assert)
        {
            assert.Expect(1);
            Action done = assert.Async();

            ConnectionsViewModel vm         = new ConnectionsViewModel(accounts[0].ToEntityReference(), null, 10, null);
            ObservableConnection connection = vm.ConnectionEdit.GetValue();

            connection.OnSaveComplete += delegate(string arg)
            {
                assert.Equal(arg, null, "Save Error " + arg);
                done();
            };

            connection.Record1Id.SetValue(accounts[1].ToEntityReference());
            connection.Record1RoleId.SetValue(partnerRole);

            // This should save ok
            connection.SaveCommand();
        }
        public static void CheckConnectionsCollection(Assert assert)
        {
            // Add in the connection

            Entity connection = new Entity("connection");

            connection.SetAttributeValue("record1id", accounts[0].ToEntityReference());
            connection.SetAttributeValue("record2id", accounts[1].ToEntityReference());
            OrganizationServiceProxy.Create(connection);

            assert.Expect(1);
            Action done             = assert.Async();
            ConnectionsViewModel vm = new ConnectionsViewModel(accounts[0].ToEntityReference(), null, 0, null);

            vm.Connections.OnDataLoaded.Subscribe(delegate(EventData data, object args)
            {
                assert.Equal(vm.Connections.GetLength(), 1, "Only 1 connection");
                done();
            });
            vm.Search();
        }
        public ConnectionsController(ConnectionsViewModel viewModel, IMapper mapper, IMessenger messenger, IConnectionsService connectionService, ICapturePackets capturePackets)
        {
            this.viewModel = viewModel;

            this.viewModel.Connections = new ObservableCollection <ConnectionViewEntity>();

            this.mapper    = mapper;
            this.messenger = messenger;

            this.connectionService = connectionService;
            this.capturePackets    = capturePackets;

            connections = new List <DomainConnection>();
            packets     = new List <DomainConnection>();

            connectionsTimer = new DispatcherTimer();
            displayTimer     = new DispatcherTimer();
            memoryTimer      = new DispatcherTimer();

            comparer = new ConnectionViewEntityComparer();
        }
Exemple #18
0
 public MainViewModel(
     IUserDialogs userDialogs,
     INavigationService navigationService,
     ConnectionsViewModel connectionsViewModel
     ) : base(
         nameof(MainViewModel),
         userDialogs,
         navigationService
         )
 {
     Connections = connectionsViewModel;
     //Credentials = credentialsViewModel;
     //Profile = profileViewModel;
     //Setting = settingViewModel;
     //Notification = notificationViewModel;
     //CreateInvitation = createInvitationViewModel;
     //CredentialsViewModel credentialsViewModel,
     //ConnectionsViewModel connectionsViewModel,
     //ProfileViewModel profileViewModel,
     //NotificationViewModel notificationViewModel,
     //SettingViewModel settingViewModel
 }
Exemple #19
0
        public MainViewModel(IServerController serverController)
        {
            this._serverController = serverController;

            _info = new InfoPanelViewModel();
            _info.Initialize();

            _manageModel = new ActionsViewModel(this._serverController);

            _statusBar = new StatusBarViewModel();
            _statusBar.CurrentStatus = "Ready.";

            _connections = new ConnectionsViewModel(this._serverController);

            _preferences = new PreferencesViewModel();
            _preferences.PropertyChanged += _preferences_PropertyChanged;

            ServerEventHandlers handlers = new ServerEventHandlers(this);
            handlers.Register(ServerEventsGateway.Instance);

            _tray = new SystemTray(Application.Current.MainWindow, Zenith.Assets.Properties.Resources.chart_bubble);
        }
        public ActionResult DisplayConnections(ConnectionsViewModel connectionsViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("DisplayPossibilities", connectionsViewModel));
            }
            if (connectionsViewModel.DepartureCityId == connectionsViewModel.ArrivalCityId)
            {
                ModelState.AddModelError(nameof(connectionsViewModel.DepartureCityId), "Abfahrtsstad und Anfahrtsstadt sind identisch");
                ModelState.AddModelError(nameof(connectionsViewModel.ArrivalCityId), "Abfahrtsstad und Anfahrtsstadt sind identisch");
                return(View("DisplayPossibilities", connectionsViewModel));
            }

            bool found = connectionsViewModel.FindConnections(connectionsViewModel);

            if (!found)
            {
                TempData["NoConnectionThisWay"] = "Derzeit können wir Ihnen in diese Richtung keine VerkehrsVerbindungen anbieten";
                return(RedirectToAction("DisplayPossibilities"));
            }
            return(View(connectionsViewModel));
        }
Exemple #21
0
        public IActionResult Index()
        {
            var viewModel = new ConnectionsViewModel
            {
                Connections = new List <SelectListItem>
                {
                    new SelectListItem {
                        Text = "SQL Server", Value = "ExternalSQLServerConnection"
                    },
                    new SelectListItem {
                        Text = "SQLite", Value = "SQLiteConnection"
                    },
                    new SelectListItem {
                        Text = "MySQL", Value = "MySQLConnection"
                    },
                    new SelectListItem {
                        Text = "PostgreSQL", Value = "PostgreSQLConnection"
                    }
                }
            };

            return(View(viewModel));
        }
 /// <summary>
 /// Provides a deterministic way to create the Connections property.
 /// </summary>
 public static void CreateConnections()
 {
     if (_connectionsVM == null)
     {
        _connectionsVM = _iocContainer.Resolve<ConnectionsViewModel>();
     }
 }
Exemple #23
0
        private static void InitLocalisedContent()
        {
            Dictionary <string, string> parameters;
            string id;
            string logicalName;
            int    pageSize    = 10;
            string defaultView = null;

#if DEBUG
            id          = "C489707F-B5E2-E411-80D5-080027846324";
            logicalName = "account";
            parameters  = new Dictionary <string, string>();
#else
            parameters  = PageEx.GetWebResourceData(); // The allowed lookup types for the connections - e.g. account, contact, opportunity. This must be passed as a data parameter to the webresource 'account=name&contact=fullname&opportunity=name
            id          = ParentPage.Data.Entity.GetId();
            logicalName = ParentPage.Data.Entity.GetEntityName();
            ParentPage.Data.Entity.AddOnSave(CheckForSaved);
#endif
            EntityReference parent   = new EntityReference(new Guid(id), logicalName, null);
            string          entities = "account,contact,opportunity,systemuser";
            foreach (string key in parameters.Keys)
            {
                switch (key.ToLowerCase())
                {
                case "entities":
                    entities = parameters[key];
                    break;

                case "pageSize":
                    pageSize = int.Parse(parameters[key]);
                    break;

                case "view":
                    defaultView = parameters[key];
                    break;
                }
            }

            // Get the view
            QueryParser queryParser = new QueryParser(new string[] { "connection" });
            queryParser.GetView("connection", defaultView);
            queryParser.QueryMetadata();
            EntityQuery        connectionViews = queryParser.EntityLookup["connection"];
            string             viewName        = connectionViews.Views.Keys[0];
            FetchQuerySettings view            = connectionViews.Views[viewName];

            vm = new ConnectionsViewModel(parent, entities.Split(","), pageSize, view);

            // Bind Connections grid
            GridDataViewBinder connectionsGridDataBinder = new GridDataViewBinder();
            List <Column>      columns = view.Columns;

            // Role2Id Column - provided it is in the view!
            foreach (Column col in columns)
            {
                switch (col.Field)
                {
                case "record2roleid":
                    XrmLookupEditor.BindColumn(col, vm.RoleSearchCommand, "connectionroleid", "name,category", "");
                    break;

                case "description":
                    XrmTextEditor.BindColumn(col);
                    break;

                case "effectivestart":
                case "effectiveend":
                    XrmDateEditor.BindColumn(col, true);
                    break;
                }
            }


            connectionsGrid = connectionsGridDataBinder.DataBindXrmGrid(vm.Connections, columns, "container", "pager", true, false);

            connectionsGrid.OnActiveCellChanged.Subscribe(delegate(EventData e, object data)
            {
                OnCellChangedEventData eventData = (OnCellChangedEventData)data;
                vm.SelectedConnection.SetValue((Connection)connectionsGrid.GetDataItem(eventData.Row));
            });

            connectionsGridDataBinder.BindClickHandler(connectionsGrid);
            // Let's not use a hover button because it get's in the way of the editable grid!
            //RowHoverPlugin rowButtons = new RowHoverPlugin("gridButtons");
            //connectionsGrid.RegisterPlugin(rowButtons);

            ViewBase.RegisterViewModel(vm);

            OverrideMetadata();

            jQuery.Window.Resize(OnResize);
            jQuery.OnDocumentReady(delegate()
            {
                OnResize(null);
                vm.Search();
            });
        }
Exemple #24
0
 public MainPageDetail()
 {
     model          = new ConnectionsViewModel(Navigation);
     BindingContext = model;
     InitializeComponent();
 }
        public MainWindow()
        {
            InitializeComponent();

            _timer          = new Timer();
            _timer.Interval = DispayTimeOut;
            _timer.Tick    += (s, o) =>
            {
                FadeOut();
                _timer.Enabled = false;
            };
            _context = new ConnectionsViewModel();
            FormFadeOut.Completed += (s, o) => Hide();

            _notify = new NotifyIcon {
                Text = "VPN Client", Icon = Properties.Resources.disconnected, Visible = true
            };
            _notify.MouseClick += (pS, pArg) =>

            {
                if (!_aboutShowing && pArg.Button == MouseButtons.Left)
                {
                    _timer.Enabled = false;
                    if (!IsVisible)
                    {
                        Show();
                        Activate();
                        FormFade.Begin();
                    }
                    else
                    {
                        FadeOut();
                    }
                }
            };

            _notify.ContextMenu = new ContextMenu(new[]
            {
                new MenuItem("&About",
                             (pS, pE) => ShowAboutDialog()),
                new MenuItem("-"),
                new MenuItem("&Exit",
                             (pS, pE) => Application.Current.Shutdown())
            });

            _context.NewConnection += pCon => UpdateNotifyIcon();
            _context.Connecting    += pCon => UpdateNotifyIcon();
            DataContext             = _context;
            _context.Connected     +=
                pCon =>
                Dispatcher.BeginInvoke(
                    new Action(() =>
            {
                if (!IsActive)
                {
                    _notify.ShowBalloonTip(2000, "OpenVPN", "You are connected to " + pCon.Name,
                                           ToolTipIcon.Info);
                }
                UpdateNotifyIcon();
            }));
            _context.Disconnected += pCon => Dispatcher.BeginInvoke(
                new Action(
                    () =>
            {
                if (!IsActive)
                {
                    _notify.ShowBalloonTip(2000, "OpenVPN", "You are disconnected from " + pCon.Name,
                                           ToolTipIcon.Info);
                }
                UpdateNotifyIcon();
            }));
        }
 /// <summary>
 /// Provides a deterministic way to delete the Connections property.
 /// </summary>
 public static void ClearConnections()
 {
     _connectionsVM.Cleanup();
     _connectionsVM = null;
 }
Exemple #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AppViewModel" /> class.
        /// </summary>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="menuViewModel">The menu view model.</param>
        /// <param name="errorViewModel">The error view model.</param>
        /// <param name="connectionsViewModel">The connections view model.</param>
        public AppViewModel(IEventAggregator eventAggregator, MenuViewModel menuViewModel, ErrorViewModel errorViewModel, ConnectionsViewModel connectionsViewModel)
        {
            Ensure.That(eventAggregator).IsNotNull();
            Ensure.That(menuViewModel).IsNotNull();
            Ensure.That(errorViewModel).IsNotNull();
            Ensure.That(connectionsViewModel).IsNotNull();

            _eventAggregator = eventAggregator;
            _eventAggregator.Subscribe(this);

            _navigator = new Navigator <IViewModel>(this);

            Menu  = menuViewModel;
            Error = errorViewModel;

            DisplayName = "Overseer";

            ActivateItem(connectionsViewModel);
        }