Skip to content

Commit

Permalink
Closes #6 and fixes regression bug which caused buttons not to get di…
Browse files Browse the repository at this point in the history
…sabled after executing.
  • Loading branch information
sceeter89 committed Sep 30, 2015
1 parent 6779780 commit 9bced54
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 86 deletions.
44 changes: 12 additions & 32 deletions Jira Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,34 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yakuza.JiraClient.IO", "Yak
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{97C43D4E-239B-401E-AC7A-F52F24D4CD64}.Debug|Any CPU.ActiveCfg = Debug|x86
{97C43D4E-239B-401E-AC7A-F52F24D4CD64}.Debug|x86.ActiveCfg = Debug|x86
{97C43D4E-239B-401E-AC7A-F52F24D4CD64}.Debug|x86.Build.0 = Debug|x86
{97C43D4E-239B-401E-AC7A-F52F24D4CD64}.Release|Any CPU.ActiveCfg = Release|x86
{97C43D4E-239B-401E-AC7A-F52F24D4CD64}.Release|x86.ActiveCfg = Release|x86
{97C43D4E-239B-401E-AC7A-F52F24D4CD64}.Release|x86.Build.0 = Release|x86
{19DF2ACB-AAD3-4DD7-9B8A-E75AA193D2CE}.Debug|Any CPU.ActiveCfg = Debug|x86
{19DF2ACB-AAD3-4DD7-9B8A-E75AA193D2CE}.Debug|x86.ActiveCfg = Debug|x86
{19DF2ACB-AAD3-4DD7-9B8A-E75AA193D2CE}.Debug|x86.Build.0 = Debug|x86
{19DF2ACB-AAD3-4DD7-9B8A-E75AA193D2CE}.Release|Any CPU.ActiveCfg = Release|x86
{19DF2ACB-AAD3-4DD7-9B8A-E75AA193D2CE}.Release|x86.ActiveCfg = Release|x86
{19DF2ACB-AAD3-4DD7-9B8A-E75AA193D2CE}.Release|x86.Build.0 = Release|x86
{ADD8F9A1-DAE9-4CC2-8B5D-A5B36F4E7D98}.Debug|Any CPU.ActiveCfg = Debug|x86
{ADD8F9A1-DAE9-4CC2-8B5D-A5B36F4E7D98}.Debug|x86.ActiveCfg = Debug|x86
{ADD8F9A1-DAE9-4CC2-8B5D-A5B36F4E7D98}.Debug|x86.Build.0 = Debug|x86
{ADD8F9A1-DAE9-4CC2-8B5D-A5B36F4E7D98}.Release|Any CPU.ActiveCfg = Release|x86
{ADD8F9A1-DAE9-4CC2-8B5D-A5B36F4E7D98}.Release|x86.ActiveCfg = Release|x86
{ADD8F9A1-DAE9-4CC2-8B5D-A5B36F4E7D98}.Release|x86.Build.0 = Release|x86
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Debug|x86.ActiveCfg = Debug|Any CPU
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Debug|x86.Build.0 = Debug|Any CPU
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Release|Any CPU.Build.0 = Release|Any CPU
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Release|x86.ActiveCfg = Release|Any CPU
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Release|x86.Build.0 = Release|Any CPU
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Debug|x86.ActiveCfg = Debug|Any CPU
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Debug|x86.Build.0 = Debug|Any CPU
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Release|Any CPU.Build.0 = Release|Any CPU
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Release|x86.ActiveCfg = Release|Any CPU
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Release|x86.Build.0 = Release|Any CPU
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Debug|x86.ActiveCfg = Debug|Any CPU
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Debug|x86.Build.0 = Debug|Any CPU
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Release|Any CPU.Build.0 = Release|Any CPU
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Release|x86.ActiveCfg = Release|Any CPU
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Release|x86.Build.0 = Release|Any CPU
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Debug|x86.ActiveCfg = Debug|x86
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Debug|x86.Build.0 = Debug|x86
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Release|x86.ActiveCfg = Release|x86
{7DBBDE05-EF7F-4FB3-B4D5-540A03E4B9B4}.Release|x86.Build.0 = Release|x86
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Debug|x86.ActiveCfg = Debug|x86
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Debug|x86.Build.0 = Debug|x86
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Release|x86.ActiveCfg = Release|x86
{3BAEF616-C997-4B97-9BC7-01B4641C11AD}.Release|x86.Build.0 = Release|x86
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Debug|x86.ActiveCfg = Debug|x86
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Debug|x86.Build.0 = Debug|x86
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Release|x86.ActiveCfg = Release|x86
{FCBE50BC-7CC8-4C86-BEE9-6F86FF34A912}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,23 @@
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Fluency, Version=1.0.57.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
3 changes: 2 additions & 1 deletion Yakuza.JiraClient.Api/Model/JiraModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Yakuza.JiraClient.Api.Model
{
#pragma warning disable JustCode_CSharp_TypeFileNameMismatch // Types not matching file names
public class RawSearchResults
{
public string Expand { get; set; }
Expand Down Expand Up @@ -336,5 +337,5 @@ public class RawGroup
public string Name { get; set; }
public string Self { get; set; }
}

#pragma warning restore JustCode_CSharp_TypeFileNameMismatch // Types not matching file names
}
6 changes: 6 additions & 0 deletions Yakuza.JiraClient.IO/Jira/SessionInteractionMicroservice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ public async void Handle(AttemptLoginMessage message)
return;
}

if (response.Data == null)
{
_messageBus.Send(new AttemptLoginResponse(new LoginAttemptResult { WasSuccessful = false, ErrorMessage = string.Format("Given address '{0}' does not point at valid JIRA server.", _configuration.JiraUrl) }));
return;
}

_configuration.JiraSessionId = response.Data.Session.Value;
_messageBus.Send(new AttemptLoginResponse(new LoginAttemptResult { WasSuccessful = true }));
}
Expand Down
21 changes: 11 additions & 10 deletions Yakuza.JiraClient.IO/Yakuza.JiraClient.IO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,23 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Expand Down
23 changes: 11 additions & 12 deletions Yakuza.JiraClient.Messaging/Yakuza.JiraClient.Messaging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,23 @@
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
1 change: 0 additions & 1 deletion Yakuza.JiraClient/Service/ConnectionChecker.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using Yakuza.JiraClient.Api.Messages.Actions.Authentication;
using System.Windows.Threading;
using Yakuza.JiraClient.Api;
using Yakuza.JiraClient.Api.Messages.Actions;
using Yakuza.JiraClient.Messaging.Api;
using Yakuza.JiraClient.Api.Messages.IO.Jira;
Expand Down
37 changes: 21 additions & 16 deletions Yakuza.JiraClient/ViewModel/LoginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,23 @@ public LoginViewModel(IMessageBus messenger, Configuration configuration)
_messenger.Register(this);
}

private async Task Login(string password)
private void SetIsBusy(bool isBusy)
{
_isBusy = true;
_isBusy = isBusy;
LogoutCommand.RaiseCanExecuteChanged();
LoginCommand.RaiseCanExecuteChanged();
}

private void Login(string password)
{
SetIsBusy(true);
_messenger.LogMessage("Trying to log in JIRA: " + JiraUrl);
_messenger.Send(new AttemptLoginMessage(JiraUrl, Username, password));
}

private async Task Logout()
private void Logout()
{
_isBusy = true;
LogoutCommand.RaiseCanExecuteChanged();
LoginCommand.RaiseCanExecuteChanged();

SetIsBusy(true);
_messenger.LogMessage("Logging out...");
_messenger.Send(new LogoutMessage());
}
Expand All @@ -87,9 +89,7 @@ public void Handle(LoggedInMessage message)
_messenger.Send(new GetProfileDetailsMessage());
IsConnected = true;

_isBusy = false;
LogoutCommand.RaiseCanExecuteChanged();
LoginCommand.RaiseCanExecuteChanged();
SetIsBusy(false);
}

public void Handle(LoggedOutMessage message)
Expand All @@ -99,9 +99,7 @@ public void Handle(LoggedOutMessage message)
IsConnected = false;
_messenger.LogMessage("Logged out successfully", LogLevel.Info);

_isBusy = false;
LogoutCommand.RaiseCanExecuteChanged();
LoginCommand.RaiseCanExecuteChanged();
SetIsBusy(false);
}

public void Handle(IsLoggedInMessage message)
Expand Down Expand Up @@ -210,19 +208,27 @@ public bool IsDisconnected
}
}

private RelayCommand<PasswordBox> _loginCommand;
public RelayCommand<PasswordBox> LoginCommand
{
get
{
if (_loginCommand == null)
_loginCommand = new RelayCommand<PasswordBox>(password => Login(password.Password), p => _isBusy == false);

return new RelayCommand<PasswordBox>(async password => await Login(password.Password), p => _isBusy == false);
return _loginCommand;
}
}

private RelayCommand _logoutCommand;
public RelayCommand LogoutCommand
{
get
{
return new RelayCommand(async () => await Logout(), () => _isBusy == false);
if(_logoutCommand == null)
_logoutCommand = new RelayCommand(() => Logout(), () => _isBusy == false);

return _logoutCommand;
}
}

Expand All @@ -233,7 +239,6 @@ public RawProfileDetails Profile
{
_profile = value;
RaisePropertyChanged();

}
}

Expand Down
24 changes: 22 additions & 2 deletions Yakuza.JiraClient/ViewModel/SearchIssuesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,28 @@ public void Handle(SearchFailedResponse message)
SetIsBusy(false);
}

public RelayCommand SearchCommand { get { return new RelayCommand(DoSearch, () => _isBusy == false); } }
public RelayCommand CustomSearchCommand { get { return new RelayCommand(DoCustomSearch, () => _isBusy == false); } }
private RelayCommand _searchCommand;
public RelayCommand SearchCommand
{
get
{
if (_searchCommand == null)
_searchCommand = new RelayCommand(DoSearch, () => _isBusy == false);

return _searchCommand;
}
}
private RelayCommand _customSearchCommand;
public RelayCommand CustomSearchCommand
{
get
{
if (_customSearchCommand == null)
_customSearchCommand = new RelayCommand(DoCustomSearch, () => _isBusy == false);

return _customSearchCommand;
}
}
public ObservableCollection<JiraIssue> FoundIssues { get; private set; }
public IEnumerable<ISearchableField> SearchableFields { get; private set; }

Expand Down

0 comments on commit 9bced54

Please sign in to comment.