diff --git a/Bugger.Applications.Test/Services/DataServiceTest.cs b/Bugger.Applications.Test/Services/DataServiceTest.cs index 60e8c4a..09b4269 100644 --- a/Bugger.Applications.Test/Services/DataServiceTest.cs +++ b/Bugger.Applications.Test/Services/DataServiceTest.cs @@ -26,7 +26,7 @@ public void GeneralDataServiceTest() dataService.UserBugs.Add( new Bug() { - ID = 1, + ID = "1", Title = "Bug1", Description = "Description for Bug1.", Type = BugType.Red, @@ -44,7 +44,7 @@ public void GeneralDataServiceTest() dataService.UserBugs.Add( new Bug() { - ID = 6, + ID = "6", Title = "Bug6", Description = "Description for Bug6.", AssignedTo = "Pupil", @@ -63,7 +63,7 @@ public void GeneralDataServiceTest() dataService.TeamBugs.Add( new Bug() { - ID = 5, + ID = "5", Title = "Bug5", Description = "Description for Bug5.", Type = BugType.Red, diff --git a/Bugger.Applications.Test/ViewModels/FloatingViewModelTest.cs b/Bugger.Applications.Test/ViewModels/FloatingViewModelTest.cs index 90502fc..c9be7dc 100644 --- a/Bugger.Applications.Test/ViewModels/FloatingViewModelTest.cs +++ b/Bugger.Applications.Test/ViewModels/FloatingViewModelTest.cs @@ -55,7 +55,7 @@ public void PropertiesWithNotification() dataService.UserBugs.Add( new Bug() { - ID = 1, + ID = "1", Title = "Bug1", Description = "Description for Bug1.", Type = BugType.Red, @@ -74,7 +74,7 @@ public void PropertiesWithNotification() dataService.UserBugs.Add( new Bug() { - ID = 6, + ID = "6", Title = "Bug6", Description = "Description for Bug6.", AssignedTo = "Pupil", diff --git a/Bugger.Applications.Test/ViewModels/TeamBugsViewModelTest.cs b/Bugger.Applications.Test/ViewModels/TeamBugsViewModelTest.cs index bb62fc7..2dde9ad 100644 --- a/Bugger.Applications.Test/ViewModels/TeamBugsViewModelTest.cs +++ b/Bugger.Applications.Test/ViewModels/TeamBugsViewModelTest.cs @@ -22,7 +22,7 @@ public void GenaralTeamBugsViewModelTest() dataService.TeamBugs.Add( new Bug() { - ID = 5, + ID = "5", Title = "Bug5", Description = "Description for Bug5.", Type = BugType.Red, diff --git a/Bugger.Applications.Test/ViewModels/UserBugsViewModelTest.cs b/Bugger.Applications.Test/ViewModels/UserBugsViewModelTest.cs index c0b3190..d474059 100644 --- a/Bugger.Applications.Test/ViewModels/UserBugsViewModelTest.cs +++ b/Bugger.Applications.Test/ViewModels/UserBugsViewModelTest.cs @@ -23,7 +23,7 @@ public void GenaralUserBugsViewModelTest() dataService.UserBugs.Add( new Bug() { - ID = 1, + ID = "1", Title = "Bug1", Description = "Description for Bug1.", Type = BugType.Red, @@ -38,7 +38,7 @@ public void GenaralUserBugsViewModelTest() dataService.UserBugs.Add( new Bug() { - ID = 6, + ID = "6", Title = "Bug6", Description = "Description for Bug6.", AssignedTo = "Pupil", diff --git a/Bugger.Applications/Controllers/DataController.cs b/Bugger.Applications/Controllers/DataController.cs index e8b4413..64fa843 100644 --- a/Bugger.Applications/Controllers/DataController.cs +++ b/Bugger.Applications/Controllers/DataController.cs @@ -92,6 +92,17 @@ public void TimerStart() this.dataService.UserBugsProgressValue = 0; this.dataService.TeamBugsProgressValue = 0; this.timerStarted = true; + + RefreshBugVisiblefields(); + } + + private void RefreshBugVisiblefields() + { + this.dataService.VisibleBugFields.Clear(); + foreach (var field in this.ActiveProxy.GetVisibleBugFields()) + { + dataService.VisibleBugFields.Add(field); + } } public void TimerStop() @@ -134,6 +145,8 @@ private void RefreshBugsCommandExecute() this.dataService.TeamBugsQueryState = QueryStatus.NotWorking; this.dataService.RefreshTime = DateTime.Now; + RefreshBugVisiblefields(); + if (!string.IsNullOrWhiteSpace(Settings.Default.UserName)) { this.dataService.UserBugsQueryState = QueryStatus.Qureying; @@ -147,6 +160,7 @@ private void RefreshBugsCommandExecute() { this.dataService.UserBugsQueryState = QueryStatus.FillingData; this.dataService.UserBugsProgressValue = 50; + UpdateCommands(); return task.Result; }, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, currentSynchronizationTaskScheduler) diff --git a/Bugger.Applications/Controllers/ProxyController.cs b/Bugger.Applications/Controllers/ProxyController.cs index d7c3c8b..3a33f94 100644 --- a/Bugger.Applications/Controllers/ProxyController.cs +++ b/Bugger.Applications/Controllers/ProxyController.cs @@ -2,6 +2,7 @@ using Bugger.Applications.Properties; using Bugger.Applications.Services; using Bugger.Proxy; +using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; @@ -49,7 +50,9 @@ protected override void OnInitialize() } else if (this.ProxyService.Proxies.Any()) { - this.proxyService.ActiveProxy = this.proxyService.Proxies.First(); + + var jiraProxy = this.proxyService.Proxies.FirstOrDefault(x => x.ProxyName.IndexOf("jira", 0, StringComparison.CurrentCultureIgnoreCase) != -1); + this.proxyService.ActiveProxy = jiraProxy ?? this.proxyService.Proxies.First(); } else { diff --git a/Bugger.Applications/Properties/AssemblyInfo.cs b/Bugger.Applications/Properties/AssemblyInfo.cs index e519ce8..636e4c9 100644 --- a/Bugger.Applications/Properties/AssemblyInfo.cs +++ b/Bugger.Applications/Properties/AssemblyInfo.cs @@ -33,6 +33,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.3.0.0")] -[assembly: AssemblyFileVersion("0.3.0.0")] +[assembly: AssemblyVersion("0.4.0.0")] +[assembly: AssemblyFileVersion("0.4.0.0")] [assembly: InternalsVisibleTo("Bugger.Applications.Test")] diff --git a/Bugger.Applications/Services/DataService.cs b/Bugger.Applications/Services/DataService.cs index 2c0e2c4..d931a91 100644 --- a/Bugger.Applications/Services/DataService.cs +++ b/Bugger.Applications/Services/DataService.cs @@ -19,6 +19,7 @@ internal class DataService : DataModel, IDataService private int userBugsProgressValue; private int teamBugsProgressValue; private InitializeStatus initializeStatus; + private MultiThreadingObservableCollection visibleFields; #endregion [ImportingConstructor] @@ -32,6 +33,7 @@ public DataService() this.teamBugsQueryState = QueryStatus.QureyPause; this.teamBugsProgressValue = 0; this.initializeStatus = InitializeStatus.Initializing; + this.visibleFields = new MultiThreadingObservableCollection(); } #region Properties @@ -39,6 +41,14 @@ public DataService() public MultiThreadingObservableCollection TeamBugs { get { return this.teamBugs; } } + public MultiThreadingObservableCollection VisibleBugFields + { + get + { + return this.visibleFields; + } + } + public DateTime RefreshTime { get { return this.refreshTime; } diff --git a/Bugger.Applications/Services/IDataService.cs b/Bugger.Applications/Services/IDataService.cs index b764bd2..57b597d 100644 --- a/Bugger.Applications/Services/IDataService.cs +++ b/Bugger.Applications/Services/IDataService.cs @@ -12,6 +12,8 @@ public interface IDataService : INotifyPropertyChanged MultiThreadingObservableCollection TeamBugs { get; } + MultiThreadingObservableCollection VisibleBugFields { get; } + DateTime RefreshTime { get; set; } QueryStatus UserBugsQueryState { get; set; } diff --git a/Bugger.Applications/ViewModels/FloatingViewModel.cs b/Bugger.Applications/ViewModels/FloatingViewModel.cs index 4e891a0..64b0989 100644 --- a/Bugger.Applications/ViewModels/FloatingViewModel.cs +++ b/Bugger.Applications/ViewModels/FloatingViewModel.cs @@ -49,7 +49,7 @@ public FloatingViewModel(IFloatingView view, IDataService dataService, IPresenta } else { - ViewCore.Left = presentationService.VirtualScreenWidth - 200; + ViewCore.Left = 0; ViewCore.Top = 50; } diff --git a/Bugger.Applications/ViewModels/TeamBugsViewModel.cs b/Bugger.Applications/ViewModels/TeamBugsViewModel.cs index 027c8ac..958a8bc 100644 --- a/Bugger.Applications/ViewModels/TeamBugsViewModel.cs +++ b/Bugger.Applications/ViewModels/TeamBugsViewModel.cs @@ -23,6 +23,11 @@ public TeamBugsViewModel(ITeamBugsView view, IDataService dataService) #region Properties public ObservableCollection Bugs { get { return this.dataService.TeamBugs; } } + public ObservableCollection VisibleBugFields + { + get { return this.dataService.VisibleBugFields; } + } + #endregion } } diff --git a/Bugger.Applications/ViewModels/UserBugsViewModel.cs b/Bugger.Applications/ViewModels/UserBugsViewModel.cs index b988036..d681078 100644 --- a/Bugger.Applications/ViewModels/UserBugsViewModel.cs +++ b/Bugger.Applications/ViewModels/UserBugsViewModel.cs @@ -1,17 +1,21 @@ -using BigEgg.Framework.Applications.ViewModels; +using System; +using BigEgg.Framework.Applications.ViewModels; using Bugger.Applications.Services; using Bugger.Applications.Views; using Bugger.Domain.Models; using System.Collections.ObjectModel; +using System.ComponentModel; using System.ComponentModel.Composition; namespace Bugger.Applications.ViewModels -{ +{ [Export] public class UserBugsViewModel : ViewModel { #region Fields + private readonly IDataService dataService; + #endregion [ImportingConstructor] @@ -22,7 +26,17 @@ public UserBugsViewModel(IUserBugsView view, IDataService dataService) } #region Properties - public ObservableCollection Bugs { get { return this.dataService.UserBugs; } } + + public ObservableCollection Bugs + { + get { return this.dataService.UserBugs; } + } + + public ObservableCollection VisibleBugFields + { + get { return this.dataService.VisibleBugFields; } + } + #endregion } } diff --git a/Bugger.Domain.Test/Bugger.Domain.Test.csproj b/Bugger.Domain.Test/Bugger.Domain.Test.csproj index 9806884..33221dc 100644 --- a/Bugger.Domain.Test/Bugger.Domain.Test.csproj +++ b/Bugger.Domain.Test/Bugger.Domain.Test.csproj @@ -55,6 +55,9 @@ Bugger.Domain + + + diff --git a/Bugger.Presentation/Views/UserBugsView.xaml.cs b/Bugger.Presentation/Views/UserBugsView.xaml.cs index d97e7db..cd9465e 100644 --- a/Bugger.Presentation/Views/UserBugsView.xaml.cs +++ b/Bugger.Presentation/Views/UserBugsView.xaml.cs @@ -1,9 +1,10 @@ -using BigEgg.Framework.Applications.Views; -using Bugger.Applications.ViewModels; -using Bugger.Applications.Views; +using System.Collections.Specialized; using System.ComponentModel.Composition; +using System.Windows; using System.Windows.Controls; using System.Windows.Data; +using Bugger.Applications.ViewModels; +using Bugger.Applications.Views; namespace Bugger.Presentation.Views { @@ -16,6 +17,39 @@ public partial class UserBugsView : UserControl, IUserBugsView public UserBugsView() { InitializeComponent(); + + CollectionView myCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(BugDataGrid.Items); + ((INotifyCollectionChanged)myCollectionView).CollectionChanged += DataGridCollectionChanged; + } + + /// + /// This is hack to update visibility of DataGrid fields + /// + /// + /// + private void DataGridCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + var dataContext = this.DataContext as UserBugsViewModel; + + if (dataContext != null) + { + foreach (var column in BugDataGrid.Columns) + { + if (column.Header == null) + { + continue; + } + + if (dataContext.VisibleBugFields.Contains(column.Header.ToString())) + { + column.Visibility = Visibility.Visible; + } + else + { + column.Visibility = Visibility.Collapsed; + } + } + } } } } diff --git a/Bugger.Presentation/app.config b/Bugger.Presentation/app.config new file mode 100644 index 0000000..195db1f --- /dev/null +++ b/Bugger.Presentation/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Bugger.Proxies/Bugger.Proxy.FakeProxy/FakeProxy.cs b/Bugger.Proxies/Bugger.Proxy.FakeProxy/FakeProxy.cs index 925ed3a..524dc23 100644 --- a/Bugger.Proxies/Bugger.Proxy.FakeProxy/FakeProxy.cs +++ b/Bugger.Proxies/Bugger.Proxy.FakeProxy/FakeProxy.cs @@ -44,7 +44,7 @@ protected override void OnInitialize() { this.bugs.Add(new Bug() { - ID = 1, + ID = "1", Title = "Bug1", Description = "Description for Bug1.", Type = BugType.Red, @@ -57,7 +57,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 2, + ID = "2", Title = "Bug2", Description = "Description for Bug2.", Type = BugType.Red, @@ -70,7 +70,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 3, + ID = "3", Title = "Bug3", Description = "Description for Bug3.", Type = BugType.Red, @@ -83,7 +83,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 4, + ID = "4", Title = "Bug4", Description = "Description for Bug4.", Type = BugType.Red, @@ -97,7 +97,7 @@ protected override void OnInitialize() this.bugs.Add(new Bug() { - ID = 5, + ID = "5", Title = "Bug5", Description = "Description for Bug5.", Type = BugType.Red, @@ -110,7 +110,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 6, + ID = "6", Title = "Bug6", Description = "Description for Bug6.", AssignedTo = "Pupil", @@ -122,7 +122,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 7, + ID = "7", Title = "Bug7", Description = "Description for Bug7.", AssignedTo = "User1", @@ -134,7 +134,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 8, + ID = "8", Title = "Bug8", Description = "Description for Bug8.", Type = BugType.Red, @@ -147,7 +147,7 @@ protected override void OnInitialize() this.bugs.Add(new Bug() { - ID = 9, + ID = "9", Title = "Bug9", Description = "Description for Bug9.", AssignedTo = "BigEgg", @@ -159,7 +159,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 10, + ID = "10", Title = "Bug10", Description = "Description for Bug10.", Type = BugType.Red, @@ -172,7 +172,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 11, + ID = "11", Title = "Bug11", Description = "Description for Bug11.", Type = BugType.Red, @@ -185,7 +185,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 12, + ID = "12", Title = "Bug12", Description = "Description for Bug12.", Type = BugType.Red, @@ -199,7 +199,7 @@ protected override void OnInitialize() this.bugs.Add(new Bug() { - ID = 13, + ID = "13", Title = "Bug13", Description = "Description for Bug13.", Type = BugType.Red, @@ -212,7 +212,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 14, + ID = "14", Title = "Bug14", Description = "Description for Bug14.", AssignedTo = "Pupil", @@ -224,7 +224,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 15, + ID = "15", Title = "Bug15", Description = "Description for Bug15.", AssignedTo = "User1", @@ -236,7 +236,7 @@ protected override void OnInitialize() }); this.bugs.Add(new Bug() { - ID = 16, + ID = "16", Title = "Bug16", Description = "Description for Bug16.", AssignedTo = "User2", diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Bugger.Proxy.Jira.Presentation.csproj b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Bugger.Proxy.Jira.Presentation.csproj new file mode 100644 index 0000000..f4726a2 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Bugger.Proxy.Jira.Presentation.csproj @@ -0,0 +1,105 @@ + + + + + Debug + AnyCPU + {C7187DD9-ED76-4D1C-A9C9-F7C57D6E366F} + Library + Properties + Bugger.Proxy.Jira.Presentation + Bugger.Proxy.Jira.Presentation + v4.5.2 + 512 + + + true + full + false + ..\..\bin\Debug\Proxies\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\bin\Release\Proxies\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + Resources.resx + True + True + + + + JiraSettingView.xaml + + + + + MSBuild:Compile + Designer + + + + + PublicResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + {EE01D20C-0F89-4219-A615-E5566A73814E} + BigEgg.Framework + + + {e8727087-75f2-435f-bd11-78b4dff59a40} + Bugger.Proxy + + + {4452f036-1e67-4afa-9ba5-e3824aa21724} + Bugger.Proxy.Jira + + + + + + + + \ No newline at end of file diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ItemsToStringConverter.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ItemsToStringConverter.cs new file mode 100644 index 0000000..e855ce7 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ItemsToStringConverter.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Windows.Data; + +namespace Bugger.Proxy.Jira.Presentation.Converters +{ + public class ItemsToStringConverter : IValueConverter + { + private static readonly ItemsToStringConverter defaultInstance = new ItemsToStringConverter(); + + public static ItemsToStringConverter Default { get { return defaultInstance; } } + + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + string str = string.Join("; ", value as ObservableCollection); + if (str.Length > 20) + { + str = str.Substring(0, 17) + "..."; + } + + return str; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToColorConverter.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToColorConverter.cs new file mode 100644 index 0000000..34ed199 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToColorConverter.cs @@ -0,0 +1,39 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Media; +using Bugger.Proxy.Jira.Models; + +namespace Bugger.Proxy.Jira.Presentation.Converters +{ + public class ProgressTypesToColorConverter : IValueConverter + { + private static readonly ProgressTypesToColorConverter defaultInstance = new ProgressTypesToColorConverter(); + + public static ProgressTypesToColorConverter Default { get { return defaultInstance; } } + + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var type = (ProgressTypes)value; + if (type == ProgressTypes.FailedOnConnect || + type == ProgressTypes.FailedOnGetFileds) + { + return Brushes.Red; + } + else if (type == ProgressTypes.SuccessWithError) + { + return Brushes.Orange; + } + else + { + return Brushes.Green; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToConnectionEnableConverter.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToConnectionEnableConverter.cs new file mode 100644 index 0000000..aedca94 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToConnectionEnableConverter.cs @@ -0,0 +1,49 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using Bugger.Proxy.Jira.Models; + +namespace Bugger.Proxy.Jira.Presentation.Converters +{ + public class ProgressTypesToConnectionEnableConverter : IValueConverter + { + private static readonly ProgressTypesToConnectionEnableConverter defaultInstance = new ProgressTypesToConnectionEnableConverter(); + + public static ProgressTypesToConnectionEnableConverter Default { get { return defaultInstance; } } + + + /// + /// Converts a value. + /// + /// The value produced by the binding source. + /// The type of the binding target property. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var type = (ProgressTypes)value; + return type != ProgressTypes.OnAutoFillMapSettings && + type != ProgressTypes.OnConnectProgress && + type != ProgressTypes.OnGetFiledsProgress; + } + + /// + /// Converts a value. + /// + /// The value that is produced by the binding target. + /// The type to convert to. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToIndeterminateConverter.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToIndeterminateConverter.cs new file mode 100644 index 0000000..9c7292a --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToIndeterminateConverter.cs @@ -0,0 +1,47 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using Bugger.Proxy.Jira.Models; + +namespace Bugger.Proxy.Jira.Presentation.Converters +{ + public class ProgressTypesToIndeterminateConverter : IValueConverter + { + private static readonly ProgressTypesToIndeterminateConverter defaultInstance = new ProgressTypesToIndeterminateConverter(); + + public static ProgressTypesToIndeterminateConverter Default { get { return defaultInstance; } } + + + /// + /// Converts a value. + /// + /// The value produced by the binding source. + /// The type of the binding target property. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var type = (ProgressTypes)value; + return type == ProgressTypes.OnConnectProgress ? true : false; + } + + /// + /// Converts a value. + /// + /// The value that is produced by the binding target. + /// The type to convert to. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToMappingEnableConverter.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToMappingEnableConverter.cs new file mode 100644 index 0000000..08ced5a --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToMappingEnableConverter.cs @@ -0,0 +1,47 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using Bugger.Proxy.Jira.Models; + +namespace Bugger.Proxy.Jira.Presentation.Converters +{ + public class ProgressTypesToMappingEnableConverter : IValueConverter + { + private static readonly ProgressTypesToMappingEnableConverter defaultInstance = new ProgressTypesToMappingEnableConverter(); + + public static ProgressTypesToMappingEnableConverter Default { get { return defaultInstance; } } + + + /// + /// Converts a value. + /// + /// The value produced by the binding source. + /// The type of the binding target property. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var type = (ProgressTypes)value; + return type == ProgressTypes.Success || type == ProgressTypes.SuccessWithError; + } + + /// + /// Converts a value. + /// + /// The value that is produced by the binding target. + /// The type to convert to. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToMessageConverter.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToMessageConverter.cs new file mode 100644 index 0000000..663b4a3 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToMessageConverter.cs @@ -0,0 +1,67 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using Bugger.Proxy.Jira.Models; +using Bugger.Proxy.Jira.Presentation.Properties; + +namespace Bugger.Proxy.Jira.Presentation.Converters +{ + public class ProgressTypesToMessageConverter : IValueConverter + { + private static readonly ProgressTypesToMessageConverter defaultInstance = new ProgressTypesToMessageConverter(); + + public static ProgressTypesToMessageConverter Default { get { return defaultInstance; } } + + + /// + /// Converts a value. + /// + /// The value produced by the binding source. + /// The type of the binding target property. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var type = (ProgressTypes)value; + + switch (type) + { + case ProgressTypes.OnConnectProgress: + return Resources.OnConnectProgress; + case ProgressTypes.FailedOnConnect: + return Resources.FailedOnConnect; + case ProgressTypes.OnGetFiledsProgress: + return Resources.OnGetFiledsProgress; + case ProgressTypes.FailedOnGetFileds: + return Resources.FailedOnGetFileds; + case ProgressTypes.OnAutoFillMapSettings: + return Resources.OnAutoFillMapSettings; + case ProgressTypes.Success: + return Resources.Success; + case ProgressTypes.SuccessWithError: + return Resources.SuccessWithError; + default: + return string.Empty; + } + } + + /// + /// Converts a value. + /// + /// The value that is produced by the binding target. + /// The type to convert to. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToVisibilityConverter.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToVisibilityConverter.cs new file mode 100644 index 0000000..72d2a79 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Converters/ProgressTypesToVisibilityConverter.cs @@ -0,0 +1,48 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using Bugger.Proxy.Jira.Models; + +namespace Bugger.Proxy.Jira.Presentation.Converters +{ + public class ProgressTypesToVisibilityConverter : IValueConverter + { + private static readonly ProgressTypesToVisibilityConverter defaultInstance = new ProgressTypesToVisibilityConverter(); + + public static ProgressTypesToVisibilityConverter Default { get { return defaultInstance; } } + + + /// + /// Converts a value. + /// + /// The value produced by the binding source. + /// The type of the binding target property. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var type = (ProgressTypes)value; + return type == ProgressTypes.NotWorking ? Visibility.Collapsed : Visibility.Visible; + } + + /// + /// Converts a value. + /// + /// The value that is produced by the binding target. + /// The type to convert to. + /// The converter parameter to use. + /// The culture to use in the converter. + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/DesignData/SampleJiraSettingViewModel.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/DesignData/SampleJiraSettingViewModel.cs new file mode 100644 index 0000000..82fc678 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/DesignData/SampleJiraSettingViewModel.cs @@ -0,0 +1,52 @@ +using BigEgg.Framework.Presentation; +using Bugger.Proxy.Jira.Models; +using Bugger.Proxy.Jira.Presentation.Properties; +using Bugger.Proxy.Jira.ViewModels; +using Bugger.Proxy.Jira.Views; +using System; +using System.Linq; + +namespace Bugger.Proxy.Jira.Presentation.DesignData +{ + public class SampleJiraSettingViewModel : JiraSettingViewModel + { + public SampleJiraSettingViewModel() + : base(new MockJiraSettingView()) + { + this.ConnectUri = new Uri("https://jira.practicefusion.com"); + this.JqlQuery = JqlQueries.AssignedToMeInOpensprints; + this.UserName = "abadereddin"; + this.Password = "Password"; + + this.PriorityValues.Add(new CheckString("High")); + this.PriorityValues.Add(new CheckString("Medium")); + this.PriorityValues.Add(new CheckString("Low")); + var values = this.PriorityValues.Where(x => x.Name == "High" || x.Name == "Medium"); + foreach (var value in values) + { + value.IsChecked = true; + } + this.PriorityRed = "High;Medium"; + + var field = new JiraField("Work Item Type"); + field.AllowedValues.Add("Work Item"); + field.AllowedValues.Add("Bugs"); + + var idField = new JiraField("ID"); + + this.JiraFields.Add(idField); + this.JiraFields.Add(field); + + this.PropertyMappingCollection["ID"] = "ID"; + + this.BugFilterFields.Add(field); + this.ProgressType = ProgressTypes.SuccessWithError; + this.ProgressValue = 100; + } + + private class MockJiraSettingView : MockView, IJiraSettingView + { + public string Title { get { return Resources.SettingViewTitle; } } + } + } +} diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Properties/AssemblyInfo.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..add7997 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Presentation of Bugger Proxy for Jira")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Bugger")] +[assembly: AssemblyCopyright("Copyright © BigEgg 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.4.0.0")] +[assembly: AssemblyFileVersion("0.4.0.0")] diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Properties/Resources.Designer.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Properties/Resources.Designer.cs new file mode 100644 index 0000000..9797e8c --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Properties/Resources.Designer.cs @@ -0,0 +1,315 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Bugger.Proxy.Jira.Presentation.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bugger.Proxy.Jira.Presentation.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Bug Property. + /// + public static string BugProperty { + get { + return ResourceManager.GetString("BugProperty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cancel. + /// + public static string Cancel { + get { + return ResourceManager.GetString("Cancel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Connection Details. + /// + public static string ConnectionDetails { + get { + return ResourceManager.GetString("ConnectionDetails", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Connect Settings. + /// + public static string ConnectSettingsTitle { + get { + return ResourceManager.GetString("ConnectSettingsTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to connect to the Jira service.. + /// + public static string FailedOnConnect { + get { + return ResourceManager.GetString("FailedOnConnect", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to get the Jira fields.. + /// + public static string FailedOnGetFileds { + get { + return ResourceManager.GetString("FailedOnGetFileds", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to HTTP. + /// + public static string HTTP { + get { + return ResourceManager.GetString("HTTP", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to HTTPS. + /// + public static string HTTPS { + get { + return ResourceManager.GetString("HTTPS", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Jira Field. + /// + public static string JiraField { + get { + return ResourceManager.GetString("JiraField", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Jira Query Settings. + /// + public static string JiraQuerySettingsTitle { + get { + return ResourceManager.GetString("JiraQuerySettingsTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Mapping Settings. + /// + public static string MappingSettingsTitle { + get { + return ResourceManager.GetString("MappingSettingsTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Mapping the Jira fields with Bugger:. + /// + public static string MapTitle { + get { + return ResourceManager.GetString("MapTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Enter the Jira Url. + /// + public static string NameOrURIofJira { + get { + return ResourceManager.GetString("NameOrURIofJira", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OK. + /// + public static string OK { + get { + return ResourceManager.GetString("OK", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Automatically fill the map settings.. + /// + public static string OnAutoFillMapSettings { + get { + return ResourceManager.GetString("OnAutoFillMapSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Trying to connect to the Jira server.. + /// + public static string OnConnectProgress { + get { + return ResourceManager.GetString("OnConnectProgress", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Trying to get the Jira fields.. + /// + public static string OnGetFiledsProgress { + get { + return ResourceManager.GetString("OnGetFiledsProgress", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Password. + /// + public static string Password { + get { + return ResourceManager.GetString("Password", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Pat_h:. + /// + public static string Path { + get { + return ResourceManager.GetString("Path", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Pre_view:. + /// + public static string Preview { + get { + return ResourceManager.GetString("Preview", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Set bug _Red when priority. + /// + public static string PriorityRed { + get { + return ResourceManager.GetString("PriorityRed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Protocol:. + /// + public static string Protocal { + get { + return ResourceManager.GetString("Protocal", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Jira Proxy. + /// + public static string SettingViewTitle { + get { + return ResourceManager.GetString("SettingViewTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Split the value by ";". + /// + public static string SplitBy { + get { + return ResourceManager.GetString("SplitBy", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Success.. + /// + public static string Success { + get { + return ResourceManager.GetString("Success", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Success with some non-critical problem.. + /// + public static string SuccessWithError { + get { + return ResourceManager.GetString("SuccessWithError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to _Test Connection. + /// + public static string TestConnection { + get { + return ResourceManager.GetString("TestConnection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User _name. + /// + public static string UserName { + get { + return ResourceManager.GetString("UserName", resourceCulture); + } + } + } +} diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Properties/Resources.resx b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Properties/Resources.resx new file mode 100644 index 0000000..85d2f6a --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Properties/Resources.resx @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cancel + + + Connection Details + + + Connect Settings + + + HTTP + + + HTTPS + + + Enter the Jira Url + + + OK + + + _Password + + + Pat_h: + + + Pre_view: + + + _Protocol: + + + _Test Connection + + + User _name + + + Jira Proxy + + + Mapping Settings + + + Bug Property + + + Mapping the Jira fields with Bugger: + + + Set bug _Red when priority + + + Split the value by ";" + + + Jira Field + + + Failed to connect to the Jira service. + + + Failed to get the Jira fields. + + + Automatically fill the map settings. + + + Trying to connect to the Jira server. + + + Trying to get the Jira fields. + + + Success. + + + Success with some non-critical problem. + + + Jira Query Settings + + \ No newline at end of file diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/TemplateSelectors/JiraFieldComboTemplateSelector.cs b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/TemplateSelectors/JiraFieldComboTemplateSelector.cs new file mode 100644 index 0000000..b697791 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/TemplateSelectors/JiraFieldComboTemplateSelector.cs @@ -0,0 +1,22 @@ +using System.Windows; +using System.Windows.Controls; + +namespace Bugger.Proxy.Jira.Presentation.TemplateSelectors +{ + public class JiraFieldComboTemplateSelector : DataTemplateSelector + { + public override DataTemplate SelectTemplate(object item, DependencyObject container) + { + ContentPresenter presenter = (ContentPresenter)container; + + if (presenter.TemplatedParent is ComboBox) + { + return (DataTemplate)presenter.FindResource("JiraFieldComboCollapsed"); + } + else // Templated parent is ComboBoxItem + { + return (DataTemplate)presenter.FindResource("JiraFieldComboExpanded"); + } + } + } +} diff --git a/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Views/JiraSettingView.xaml b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Views/JiraSettingView.xaml new file mode 100644 index 0000000..7ac1881 --- /dev/null +++ b/Bugger.Proxies/Bugger.Proxy.Jira.Presentation/Views/JiraSettingView.xaml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +