Example #1
0
        public override bool ShowConnectionDialog(IConnectionInfo cxInfo, bool isNewConnection)
        {
            var ConnectionData = new ConnectionData(cxInfo);
            // Prompt the user for connection string
            var dialog = new ConnectionDialog(cxInfo);
            var connectionDialogViewModel = new ConnectionDialogViewModel();

            connectionDialogViewModel.ConnectionData = ConnectionData;
            dialog.DataContext = connectionDialogViewModel;
            var dialogResult = dialog.ShowDialog();

            cxInfo.DisplayName = $"{ConnectionData.Username} @ {ConnectionData.OrganizationUrl}";
            return(dialogResult == true);
        }
Example #2
0
        private void HandleConnectionPreference([NotNull] object sender, [NotNull] RoutedEventArgs e)
        {
            Assert.ArgumentNotNull(sender, "sender");
            Assert.ArgumentNotNull(e, "e");

            var connectionDialogViewModel = new ConnectionDialogViewModel
            {
                HostName = SettingsHolder.Instance.Settings.ConnectHostName,
                Port     = SettingsHolder.Instance.Settings.ConnectPort
            };

            var dialog = new ConnectionDialog {
                DataContext = connectionDialogViewModel, Owner = this
            };

            var result = dialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                SettingsHolder.Instance.Settings.ConnectHostName = connectionDialogViewModel.HostName;
                SettingsHolder.Instance.Settings.ConnectPort     = connectionDialogViewModel.Port;
            }
        }