Ejemplo n.º 1
0
        private void DoUpdateRedmineUser()
        {
            try
            {
                if (string.IsNullOrEmpty(Settings.Default.RedmineServer) == false && string.IsNullOrEmpty(Settings.Default.RedmineApi) == false)
                {
                    Net.Api.RedmineManager manager = GetRedmineManager();
                    var user = manager.GetCurrentUser();

                    _userName           = string.Format("{0} {1}", user.FirstName, user.LastName);
                    _currentRedmineUser = user;

                    _selectProjectViewModel.ReloadProjectsList();

                    // now check if we have EasyRedmine extended API
                    try
                    {
                        var contacts = manager.GetObjectList <Net.Api.Types.Contact>(new NameValueCollection()
                        {
                        });
                        _isEasyContactApiAvailable = true;
                    }
                    catch (RedmineException e)
                    {
                        _isEasyContactApiAvailable = false;
                    }

                    InvalidateRibbon();
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Error: {0}", e.Message);

                _userName = string.Empty;

                InvalidateRibbon();
            }
        }
Ejemplo n.º 2
0
        private void DoUpdateRedmineUser()
        {
            try
            {
                if (string.IsNullOrEmpty(Settings.Default.RedmineServer) == false && string.IsNullOrEmpty(Settings.Default.RedmineApi) == false)
                {
                    Net.Api.RedmineManager manager = GetRedmineManager();
                    var user = manager.GetCurrentUser();

                    _userName = string.Format("{0} {1}", user.FirstName, user.LastName);
                    _currentRedmineUser = user;

                    _selectProjectViewModel.ReloadProjectsList();

                    // now check if we have EasyRedmine extended API
                    try
                    {
                        var contacts = manager.GetObjectList<Net.Api.Types.Contact>(new NameValueCollection() { });
                        _isEasyContactApiAvailable = true;
                    }
                    catch (RedmineException e)
                    {
                        _isEasyContactApiAvailable = false;
                    }

                    InvalidateRibbon();
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Error: {0}", e.Message);

                _userName = string.Empty;

                InvalidateRibbon();
            }
        }