Beispiel #1
0
        /// <summary>
        /// Attepts to log on to the specified instance.  The instance url must contain a user
        /// name in the format of "http://user@server:port/".
        /// </summary>
        public bool Logon(IntPtr hParentWnd, string rootUrl, string commonRoot)
        {
            Log.Verbose("Logging into Issue Services");
            if (_service != null)
            {
                Log.Verbose("Already Logged. No more work required");
                return(true);
            }

            Log.Verbose("Not Logged. Logging in");
            _connectingDialog.Argument = new object[] { hParentWnd, rootUrl, commonRoot };
            var connectionResult = _connectingDialog.ShowDialog(Win32Window.FromHandle(hParentWnd));

            if (connectionResult == DialogResult.OK)
            {
                _service = _connectingDialog.Result as IIssuesServiceConnection;
            }
            if (connectionResult == DialogResult.Abort)
            {
                ShowError(hParentWnd, _connectingDialog.Error.Message, "Login Error");
            }
            else if (connectionResult == DialogResult.Cancel)
            {
                _service = null;
            }

            Log.Verbose("Finished Logging in");
            return(_service != null);
        }
Beispiel #2
0
        public IssuesListView(IIssuesServiceConnection service, string message, string[] files)
        {
            PropertyChanged += new PropertyChangedEventHandler(DebugPropertyChanged);

            _service = service;
            _comments = message;

            _filters.ReplaceContents(_service.GetFilters());

            _assignees.AddRange(new IIssueUser[] { ReportedByUser.Instance, _service.CurrentUser });
            _assignees.AddRange(_service.GetUsers());

            _serializer = new ObjectSerializer(this,
                "_filters.SelectedText",
                "_assignedFilter.SelectedText",
                "_statusFilter.SelectedText",
                "_actions.SelectedText",
                "_assignees.SelectedText"
                );
            _serializer.ContinueOnError = true;
            _serializer.Deserialize(_storage);

            // if no filter is pre-selected, select the last one, as this is the search filter
            // this increases the performance (no need to display all items)
            if (_filters.SelectedIndex == -1 && _filters.Count > 0)
                _filters.SelectedIndex = _filters.Count - 1;

            ServerFilterChanged(String.Empty);
        }
Beispiel #3
0
        private bool TryLogon(IntPtr hParentWnd, string parameters, string commonRoot, out string message,
                              out IIssuesServiceConnection service)
        {
            IIssuesService connector = Connector;
            string         serviceUri, user, password;

            message = null;
            service = null;
            if (!TryParseParameters(hParentWnd, parameters, commonRoot, out serviceUri, out user, out password))
            {
                message = GetParamDesc();
                return(false);
            }

            try
            {
                if (!connector.Connect(serviceUri, user, password, GetAppSetting, out service))
                {
                    SaveSettings(user, serviceUri, null);
                    return(false);
                }
                return(true);
            }
            catch (Exception e)
            {
                Log.Error(e);
                message = e.Message;
                return(false);
            }
        }
Beispiel #4
0
		public IssuesListView(IIssuesServiceConnection service, string message, string[] files)
		{
			PropertyChanged += new PropertyChangedEventHandler(DebugPropertyChanged);

			_service = service;
			_comments = message;

			_filters.ReplaceContents(_service.GetFilters());

			_assignees.AddRange(new IIssueUser[] { ReportedByUser.Instance, _service.CurrentUser });
			_assignees.AddRange(_service.GetUsers());

			_serializer = new ObjectSerializer(this, 
				"_filters.SelectedText",
				"_assignedFilter.SelectedText",
				"_statusFilter.SelectedText",
				"_actions.SelectedText",
				"_assignees.SelectedText"
				);
			_serializer.ContinueOnError = true;
			_serializer.Deserialize(_storage);

			// if no filter is pre-selected, select the first one, otherwise window comes up in odd state
            if (_filters.SelectedIndex == -1 && _filters.Count > 0)
                _filters.SelectedIndex = 0;

            ServerFilterChanged(String.Empty);
		}
Beispiel #5
0
        public IssuesListView(IIssuesServiceConnection service, string message, string[] files)
        {
            PropertyChanged += new PropertyChangedEventHandler(DebugPropertyChanged);

            _service  = service;
            _comments = message;

            _filters.ReplaceContents(_service.GetFilters());

            _assignees.AddRange(new IIssueUser[] { ReportedByUser.Instance, _service.CurrentUser });
            _assignees.AddRange(_service.GetUsers());

            _serializer = new ObjectSerializer(this,
                                               "_filters.SelectedText",
                                               "_assignedFilter.SelectedText",
                                               "_statusFilter.SelectedText",
                                               "_actions.SelectedText",
                                               "_assignees.SelectedText"
                                               );
            _serializer.ContinueOnError = true;
            _serializer.Deserialize(_storage);

            // if no filter is pre-selected, select the first one, otherwise window comes up in odd state
            if (_filters.SelectedIndex == -1 && _filters.Count > 0)
            {
                _filters.SelectedIndex = 0;
            }

            ServerFilterChanged(String.Empty);
        }
Beispiel #6
0
        public IssuesListView(IIssuesServiceConnection service, string message, string[] files)
        {
            PropertyChanged += new PropertyChangedEventHandler(DebugPropertyChanged);

            _service  = service;
            _comments = message;

            _filters.ReplaceContents(_service.GetFilters());

            _assignees.AddRange(new IIssueUser[] { ReportedByUser.Instance, _service.CurrentUser });
            _assignees.AddRange(_service.GetUsers());

            _serializer = new ObjectSerializer(this,
                                               "_filters.SelectedText",
                                               "_assignedFilter.SelectedText",
                                               "_statusFilter.SelectedText",
                                               "_actions.SelectedText",
                                               "_assignees.SelectedText"
                                               );
            _serializer.ContinueOnError = true;
            _serializer.Deserialize(_storage);

            // if no filter is pre-selected, select the last one, as this is the search filter
            // this increases the performance (no need to display all items)
            if (_filters.SelectedIndex == -1 && _filters.Count > 0)
            {
                _filters.SelectedIndex = _filters.Count - 1;
            }

            ServerFilterChanged(String.Empty);
        }
Beispiel #7
0
        /// <summary> Releases any locked resources </summary>
        public void Dispose()
        {
            if (_issues != null)
            {
                _issues.Dispose();
            }
            _issues = null;

            if (_service != null)
            {
                _service.Dispose();
            }
            _service = null;
        }
Beispiel #8
0
        /// <summary>
        /// Establises a connection to the jira soap server
        /// </summary>
        public bool Connect(string url, string userName, string password, Converter<string, string> settings, out IIssuesServiceConnection connection)
        {
            try
            {
                connection = new JiraConnection(url, userName, password, settings);
                return true;
            }
            catch (SoapException se)
            {
                if (se.Message.IndexOf("RemoteAuthenticationException", StringComparison.OrdinalIgnoreCase) > 0 ||
                    se.Message.IndexOf("Invalid username or password", StringComparison.OrdinalIgnoreCase) > 0)
                {
                    Log.Error(se, "Logon failed for user {0} at {1}", userName, url);
                    connection = null;
                    return false;
                }

                throw;
            }
        }
Beispiel #9
0
        /// <summary>
        /// Establises a connection to the jira soap server
        /// </summary>
        public bool Connect(string url, string userName, string password, Converter <string, string> settings,
                            out IIssuesServiceConnection connection)
        {
            try
            {
                connection = new JiraConnection(url, userName, password, settings);
                return(true);
            }
            catch (SoapException se)
            {
                if (se.Message.IndexOf("RemoteAuthenticationException", StringComparison.OrdinalIgnoreCase) > 0 ||
                    se.Message.IndexOf("Invalid username or password", StringComparison.OrdinalIgnoreCase) > 0)
                {
                    Log.Error(se, "Logon failed for user {0} at {1}", userName, url);
                    connection = null;
                    return(false);
                }

                throw;
            }
        }
Beispiel #10
0
        bool TryLogon(IntPtr hParentWnd, string parameters, string commonRoot, out string message, out IIssuesServiceConnection service)
        {
            IIssuesService connector = this.Connector;
            string serviceUri, user, password;

            message = null;
            service = null;
            if (!TryParseParameters(hParentWnd, parameters, commonRoot, out serviceUri, out user, out password))
            {
                message = GetParamDesc();
                return false;
            }

            try
            {
                if (!connector.Connect(serviceUri, user, password, GetAppSetting, out service))
                {
                    SaveSettings(user, serviceUri, null);
                    return false;
                }
                return true;
            }
            catch (Exception e)
            {
                Log.Error(e);
                message = e.Message;
                return false;
            }
        }
Beispiel #11
0
        /// <summary> Releases any locked resources </summary>
        public void Dispose()
        {
            if (_issues != null)
                _issues.Dispose();
            _issues = null;

            if (_service != null)
                _service.Dispose();
            _service = null;
        }
Beispiel #12
0
        /// <summary>
        /// Attepts to log on to the specified instance.  The instance url must contain a user
        /// name in the format of "http://user@server:port/".
        /// </summary>
        public bool Logon(IntPtr hParentWnd, string rootUrl, string commonRoot)
        {
            Log.Verbose("Logging into Issue Services");
            if (_service != null)
            {
                Log.Verbose("Already Logged. No more work required");
                return true;
            }

            Log.Verbose("Not Logged. Logging in");
            _connectingDialog.Argument = new object[] { hParentWnd, rootUrl, commonRoot };
            var connectionResult = _connectingDialog.ShowDialog(Win32Window.FromHandle(hParentWnd));
            if ( connectionResult == DialogResult.OK )
                _service = _connectingDialog.Result as IIssuesServiceConnection;
            if ( connectionResult == DialogResult.Abort)
                ShowError(hParentWnd, _connectingDialog.Error.Message, "Login Error");
            else if (connectionResult == DialogResult.Cancel)
                _service = null;

            Log.Verbose("Finished Logging in");
            return _service != null;
        }