Что то там напилил
This commit is contained in:
@@ -8,5 +8,6 @@ namespace JiraTimeBot.Core.Configuration
|
|||||||
Settings LoadAndCheck(Action settingsSource, Action<string> errorMessageReporter);
|
Settings LoadAndCheck(Action settingsSource, Action<string> errorMessageReporter);
|
||||||
|
|
||||||
void Save(Settings settings);
|
void Save(Settings settings);
|
||||||
|
bool SettingsIsValid(Settings settings, out string message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ namespace JiraTimeBot.Core.Configuration
|
|||||||
var settingsString = JsonConvert.SerializeObject(settings);
|
var settingsString = JsonConvert.SerializeObject(settings);
|
||||||
File.WriteAllText(settingsPath, settingsString);
|
File.WriteAllText(settingsPath, settingsString);
|
||||||
}
|
}
|
||||||
private static bool SettingsIsValid(Settings settings, out string message)
|
public bool SettingsIsValid(Settings settings, out string message)
|
||||||
{
|
{
|
||||||
if (settings == null)
|
if (settings == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ using JiraTimeBot.UI.Tray;
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using JiraTimeBot.Core.Configuration;
|
||||||
|
using JiraTimeBot.Ui.ViewModels;
|
||||||
|
|
||||||
|
|
||||||
namespace JiraTimeBot.Ui
|
namespace JiraTimeBot.Ui
|
||||||
{
|
{
|
||||||
@@ -34,13 +38,45 @@ namespace JiraTimeBot.Ui
|
|||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
var mainWindow = _container.Resolve<MainWindow>();
|
var settingsManager = _container.Resolve<ISettingsManager>();
|
||||||
var nav = _container.Resolve<IApplicationNavigator>();
|
var settings = settingsManager.Load();
|
||||||
|
var scope = _container.BeginLifetimeScope("Started",
|
||||||
|
builder =>
|
||||||
|
{
|
||||||
|
if (settings != null)
|
||||||
|
{
|
||||||
|
builder.RegisterInstance(settings);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
builder.RegisterInstance(new Settings());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var appViewModel = scope.Resolve<ApplicationViewModel>();
|
||||||
|
var mainWindow = scope.Resolve<MainWindow>();
|
||||||
|
if (settings == null)
|
||||||
|
{
|
||||||
|
var settingsViewModel = scope.Resolve<SettingsViewModel>();
|
||||||
|
appViewModel.CurrentViewModel = settingsViewModel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var mainViewModel = scope.Resolve<MainPageViewModel>();
|
||||||
|
appViewModel.CurrentViewModel = mainViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
nav.NavigateToSettings();
|
|
||||||
mainWindow.ShowActivated = true;
|
mainWindow.ShowActivated = true;
|
||||||
mainWindow.Show();
|
mainWindow.Show();
|
||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void OnLoadCompleted(NavigationEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLoadCompleted(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using JiraTimeBot.Ui.ViewModels;
|
using System;
|
||||||
|
using JiraTimeBot.Ui.ViewModels;
|
||||||
|
|
||||||
namespace JiraTimeBot.Ui
|
namespace JiraTimeBot.Ui
|
||||||
{
|
{
|
||||||
public interface IRegisteredViewModels
|
public interface IRegisteredViewModels
|
||||||
{
|
{
|
||||||
SettingsViewModel Settings { get; set; }
|
Func<SettingsViewModel> Settings { get; set; }
|
||||||
MainPageViewModel MainPage { get; set; }
|
Func<MainPageViewModel> MainPage { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ApplicationNavigator : IApplicationNavigator
|
public class ApplicationNavigator : IApplicationNavigator
|
||||||
@@ -22,12 +23,12 @@ namespace JiraTimeBot.Ui
|
|||||||
|
|
||||||
public void NavigateToMain()
|
public void NavigateToMain()
|
||||||
{
|
{
|
||||||
_applicationViewModel.CurrentViewModel = _viewModels.MainPage;
|
_applicationViewModel.CurrentViewModel = _viewModels.MainPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NavigateToSettings()
|
public void NavigateToSettings()
|
||||||
{
|
{
|
||||||
_applicationViewModel.CurrentViewModel = _viewModels.Settings;
|
_applicationViewModel.CurrentViewModel = _viewModels.Settings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using Autofac;
|
using Autofac;
|
||||||
using Autofac.Extras.AggregateService;
|
using Autofac.Extras.AggregateService;
|
||||||
|
using JiraTimeBot.Core.Configuration;
|
||||||
using JiraTimeBot.Ui.Models;
|
using JiraTimeBot.Ui.Models;
|
||||||
using JiraTimeBot.Ui.ViewModels;
|
using JiraTimeBot.Ui.ViewModels;
|
||||||
|
|
||||||
@@ -16,24 +17,29 @@ namespace JiraTimeBot.Ui
|
|||||||
var result = new MainWindow();
|
var result = new MainWindow();
|
||||||
result.DataContext = c.Resolve<ApplicationViewModel>();
|
result.DataContext = c.Resolve<ApplicationViewModel>();
|
||||||
return result;
|
return result;
|
||||||
}).SingleInstance();
|
}).InstancePerLifetimeScope();
|
||||||
|
|
||||||
builder.RegisterType<ApplicationModel>().SingleInstance();
|
builder.RegisterType<SettingsManager>().As<ISettingsManager>();
|
||||||
builder.RegisterType<SettingsModel>().SingleInstance();
|
builder.RegisterType<ApplicationModel>().InstancePerLifetimeScope();
|
||||||
builder.RegisterType<MainModel>().SingleInstance();
|
builder.RegisterType<SettingsModel>().InstancePerLifetimeScope();
|
||||||
|
builder.RegisterType<MainModel>().InstancePerLifetimeScope();
|
||||||
|
|
||||||
builder.RegisterType<ApplicationViewModel>().SingleInstance();
|
builder.RegisterType<ApplicationViewModel>().InstancePerLifetimeScope();
|
||||||
builder.RegisterType<MainPageViewModel>().SingleInstance();
|
builder.RegisterType<MainPageViewModel>().InstancePerLifetimeScope();
|
||||||
builder.RegisterType<SettingsViewModel>().SingleInstance();
|
builder.RegisterType<SettingsViewModel>()
|
||||||
|
.InstancePerLifetimeScope();
|
||||||
|
|
||||||
builder.RegisterType<MainPage>().SingleInstance();
|
builder.RegisterType<MainPage>().InstancePerLifetimeScope();
|
||||||
builder.RegisterType<SettingsPage>().SingleInstance();
|
builder.RegisterType<SettingsPage>()
|
||||||
|
.AsSelf()
|
||||||
|
.As<IHavePassword>()
|
||||||
|
.InstancePerLifetimeScope();
|
||||||
|
|
||||||
builder.RegisterAggregateService<IRegisteredViewModels>();
|
builder.RegisterAggregateService<IRegisteredViewModels>();
|
||||||
|
|
||||||
builder.RegisterType<ApplicationNavigator>()
|
builder.RegisterType<ApplicationNavigator>()
|
||||||
.As<IApplicationNavigator>()
|
.As<IApplicationNavigator>()
|
||||||
.SingleInstance();
|
.InstancePerLifetimeScope();
|
||||||
|
|
||||||
var container = builder.Build();
|
var container = builder.Build();
|
||||||
|
|
||||||
|
|||||||
@@ -190,6 +190,10 @@
|
|||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\JiraTimeBot.Core\JiraTimeBot.Core.csproj">
|
||||||
|
<Project>{35D8A11F-05F8-408D-A37D-0EECD96FA67A}</Project>
|
||||||
|
<Name>JiraTimeBot.Core</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\JiraTimeBot\JiraTimeBot.csproj">
|
<ProjectReference Include="..\JiraTimeBot\JiraTimeBot.csproj">
|
||||||
<Project>{f3b89316-c38c-4ce6-9d88-0b1373cfba1a}</Project>
|
<Project>{f3b89316-c38c-4ce6-9d88-0b1373cfba1a}</Project>
|
||||||
<Name>JiraTimeBot</Name>
|
<Name>JiraTimeBot</Name>
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
{
|
{
|
||||||
public class ApplicationModel : IModel
|
public class ApplicationModel : IModel
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ApplicationModel()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,91 @@
|
|||||||
namespace JiraTimeBot.Ui.Models
|
using System;
|
||||||
|
using JiraTimeBot.Core.Configuration;
|
||||||
|
|
||||||
|
namespace JiraTimeBot.Ui.Models
|
||||||
{
|
{
|
||||||
|
//Proxy model of settings
|
||||||
public class SettingsModel : IModel
|
public class SettingsModel : IModel
|
||||||
{
|
{
|
||||||
|
private readonly Settings _settings;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public SettingsModel(Settings settings)
|
||||||
|
{
|
||||||
|
_settings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Settings Settings => _settings;
|
||||||
|
|
||||||
|
public string JiraUrl
|
||||||
|
{
|
||||||
|
get => _settings.JiraUrl;
|
||||||
|
set => _settings.JiraUrl = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int MinuterPerWorkDay
|
||||||
|
{
|
||||||
|
get => _settings.MinuterPerWorkDay;
|
||||||
|
set => _settings.MinuterPerWorkDay = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSpan ActivationTime
|
||||||
|
{
|
||||||
|
get => _settings.ActivationTime;
|
||||||
|
set => _settings.ActivationTime = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddCommentsToWorklog
|
||||||
|
{
|
||||||
|
get => _settings.AddCommentsToWorklog;
|
||||||
|
set => _settings.AddCommentsToWorklog = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string JiraPassword
|
||||||
|
{
|
||||||
|
get => _settings.JiraPassword;
|
||||||
|
set => _settings.JiraPassword = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string JiraQuery
|
||||||
|
{
|
||||||
|
get => _settings.JiraPassword;
|
||||||
|
set => _settings.JiraQuery = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string JiraUserName
|
||||||
|
{
|
||||||
|
get => _settings.JiraUserName;
|
||||||
|
set => _settings.JiraUserName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string MercurialAuthorEmail
|
||||||
|
{
|
||||||
|
get => _settings.MercurialAuthorEmail;
|
||||||
|
set => _settings.MercurialAuthorEmail = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string RepositoryPath
|
||||||
|
{
|
||||||
|
get => _settings.RepositoryPath;
|
||||||
|
set => _settings.RepositoryPath = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int RoundToMinutes
|
||||||
|
{
|
||||||
|
get => _settings.RoundToMinutes;
|
||||||
|
set => _settings.RoundToMinutes = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TimeControlTask
|
||||||
|
{
|
||||||
|
get => _settings.TimeControlTask;
|
||||||
|
set => _settings.TimeControlTask = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorkType WorkType
|
||||||
|
{
|
||||||
|
get => _settings.WorkType;
|
||||||
|
set => _settings.WorkType = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,19 +6,53 @@ namespace JiraTimeBot.Ui.ViewModels
|
|||||||
{
|
{
|
||||||
public class MainPageViewModel : ViewModelBase<MainModel>
|
public class MainPageViewModel : ViewModelBase<MainModel>
|
||||||
{
|
{
|
||||||
private readonly Func<IApplicationNavigator> _navigator;
|
private readonly IApplicationNavigator _navigator;
|
||||||
|
private DateTime _selectedDate;
|
||||||
|
|
||||||
public MainPageViewModel(MainModel model, Func<IApplicationNavigator> navigator) : base(model)
|
public MainPageViewModel(MainModel model, IApplicationNavigator navigator) : base(model)
|
||||||
{
|
{
|
||||||
_navigator = navigator;
|
_navigator = navigator;
|
||||||
|
SelectedDate = DateTime.Today;
|
||||||
OpenSettingsCommand = new RelayCommand(NavigateToSettings);
|
OpenSettingsCommand = new RelayCommand(NavigateToSettings);
|
||||||
|
SetTimeCommand = new RelayCommand(SetTime);
|
||||||
|
ShowMeetingInfoCommand = new RelayCommand(ShowMeeting);
|
||||||
|
CancelCommand = new RelayCommand(Cancel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Cancel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowMeeting()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetTime()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RelayCommand OpenSettingsCommand { get; set; }
|
public RelayCommand OpenSettingsCommand { get; set; }
|
||||||
|
|
||||||
|
public DateTime SelectedDate
|
||||||
|
{
|
||||||
|
get => _selectedDate;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedDate = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelayCommand SetTimeCommand { get; set; }
|
||||||
|
|
||||||
|
public RelayCommand ShowMeetingInfoCommand { get; set; }
|
||||||
|
|
||||||
|
public RelayCommand CancelCommand { get; set; }
|
||||||
|
|
||||||
private void NavigateToSettings()
|
private void NavigateToSettings()
|
||||||
{
|
{
|
||||||
_navigator().NavigateToSettings();
|
_navigator.NavigateToSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,75 @@
|
|||||||
using Aeroclub.CL.ASIA.Application.UI.Wpf.Commands;
|
using Aeroclub.CL.ASIA.Application.UI.Wpf.Commands;
|
||||||
using JiraTimeBot.Ui.Models;
|
using JiraTimeBot.Ui.Models;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using JiraTimeBot.Core.Configuration;
|
||||||
|
|
||||||
namespace JiraTimeBot.Ui.ViewModels
|
namespace JiraTimeBot.Ui.ViewModels
|
||||||
{
|
{
|
||||||
public class SettingsViewModel : ViewModelBase<SettingsModel>
|
public class SettingsViewModel : ViewModelBase<SettingsModel>
|
||||||
{
|
{
|
||||||
private readonly Func<IApplicationNavigator> _navigator;
|
private readonly ISettingsManager _settingsManager;
|
||||||
|
private readonly IHavePassword _passwordAccessor;
|
||||||
|
private readonly IApplicationNavigator _navigator;
|
||||||
|
|
||||||
public SettingsViewModel(SettingsModel model, Func<IApplicationNavigator> navigator) : base(model)
|
public SettingsViewModel(SettingsModel model,
|
||||||
|
ISettingsManager settingsManager,
|
||||||
|
IHavePassword passwordAccessor,
|
||||||
|
IApplicationNavigator navigator) : base(model)
|
||||||
{
|
{
|
||||||
|
_settingsManager = settingsManager;
|
||||||
|
_passwordAccessor = passwordAccessor;
|
||||||
_navigator = navigator;
|
_navigator = navigator;
|
||||||
SaveSettingsCommand = new RelayCommand(SaveSettings);
|
SaveSettingsCommand = new RelayCommand(SaveSettings);
|
||||||
|
var workModes = Enum.GetValues(typeof(WorkType));
|
||||||
|
WorkModes = new ObservableCollection<WorkType>(workModes.OfType<WorkType>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public RelayCommand SaveSettingsCommand { get; set; }
|
public RelayCommand SaveSettingsCommand { get; set; }
|
||||||
|
|
||||||
|
public ObservableCollection<WorkType> WorkModes { get; set; }
|
||||||
|
|
||||||
|
public WorkType CurrentWorkType
|
||||||
|
{
|
||||||
|
get => Model.WorkType;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Model.WorkType = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string RepositoryPath
|
||||||
|
{
|
||||||
|
get => Model.RepositoryPath;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Model.RepositoryPath = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string JiraLogin
|
||||||
|
{
|
||||||
|
get => Model.JiraUserName;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Model.JiraUserName = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SaveSettings()
|
private void SaveSettings()
|
||||||
{
|
{
|
||||||
//TODO: SaveSettingsHere
|
if(!_settingsManager.SettingsIsValid(Model.Settings, out string msg))
|
||||||
_navigator().NavigateToMain();
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Model.JiraPassword = _passwordAccessor.GetPassword();
|
||||||
|
_settingsManager.Save(Model.Settings);
|
||||||
|
_navigator.NavigateToMain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:JiraTimeBot.Ui"
|
xmlns:local="clr-namespace:JiraTimeBot.Ui"
|
||||||
xmlns:viewModels="clr-namespace:JiraTimeBot.Ui.ViewModels"
|
xmlns:viewModels="clr-namespace:JiraTimeBot.Ui.ViewModels"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance viewModels:MainPageViewModel}" >
|
d:DataContext="{d:DesignInstance viewModels:MainPageViewModel}" >
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
@@ -24,16 +25,20 @@
|
|||||||
<StackPanel Grid.Row="0"
|
<StackPanel Grid.Row="0"
|
||||||
Orientation="Vertical">
|
Orientation="Vertical">
|
||||||
<Button Content="Настройки" Command="{Binding Path=OpenSettingsCommand}" />
|
<Button Content="Настройки" Command="{Binding Path=OpenSettingsCommand}" />
|
||||||
<DatePicker />
|
<xctk:DateTimePicker AutoCloseCalendar="True"
|
||||||
|
Format="ShortDate"
|
||||||
|
Value="{Binding Path=SelectedDate}"
|
||||||
|
Kind="Local" />
|
||||||
|
<!--<DatePicker IsTodayHighlighted="True" SelectedDate="{Binding Path=SelectedDate}" />-->
|
||||||
<Button>
|
<Button>
|
||||||
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Text="Проставить на дату" />
|
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Text="Проставить на дату" />
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="2">
|
<StackPanel Grid.Row="2">
|
||||||
<CheckBox>Тестовый прогон</CheckBox>
|
<CheckBox>Тестовый прогон</CheckBox>
|
||||||
<Button Content="Проставить время"/>
|
<Button Content="Проставить время" Command="{Binding Path=SetTimeCommand}"/>
|
||||||
<Button Content="Митинг"/>
|
<Button Content="Митинг" Command="{Binding Path=ShowMeetingInfoCommand}"/>
|
||||||
<Button Content="Отменить"/>
|
<Button Content="Отменить" Command="{Binding Path=CancelCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
>
|
>
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<DataTemplate DataType="{x:Type viewModels:MainPageViewModel}">
|
<DataTemplate DataType="{x:Type viewModels:MainPageViewModel}">
|
||||||
<ui:MainPage/>
|
<ui:MainPage />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate DataType="{x:Type viewModels:SettingsViewModel}">
|
<DataTemplate DataType="{x:Type viewModels:SettingsViewModel}">
|
||||||
<ui:SettingsPage/>
|
<ui:SettingsPage/>
|
||||||
|
|||||||
@@ -43,23 +43,32 @@
|
|||||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||||
Text="Режим работы" />
|
Text="Режим работы" />
|
||||||
|
|
||||||
<ComboBox Grid.Row="0" Grid.Column="1">
|
<ComboBox Grid.Row="0" Grid.Column="1"
|
||||||
|
ItemsSource="{Binding Path=WorkModes}"
|
||||||
|
SelectedItem="{Binding Path=CurrentWorkType}"
|
||||||
|
>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||||
Text="Путь до репо" />
|
Text="Путь до репо" />
|
||||||
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" />
|
<TextBox Grid.Row="1" Grid.Column="1"
|
||||||
|
Text="{Binding Path=RepositoryPath}"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||||
Text="Логин Jira" />
|
Text="Логин Jira" />
|
||||||
|
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" />
|
<TextBox Grid.Row="2" Grid.Column="1"
|
||||||
|
Text="{Binding Path=JiraLogin}"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||||
Text="Пароль Jira" />
|
Text="Пароль Jira" />
|
||||||
|
|
||||||
<PasswordBox Grid.Row="3" Grid.Column="1"/>
|
<PasswordBox Name="PBox" Grid.Row="3" Grid.Column="1"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||||
Text="Mercurial Name" />
|
Text="Mercurial Name" />
|
||||||
|
|||||||
@@ -1,13 +1,32 @@
|
|||||||
namespace JiraTimeBot.Ui
|
using System;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace JiraTimeBot.Ui
|
||||||
{
|
{
|
||||||
|
public interface IHavePassword
|
||||||
|
{
|
||||||
|
string GetPassword();
|
||||||
|
void SetPassword(string password);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for SettingsPage.xaml
|
/// Interaction logic for SettingsPage.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class SettingsPage
|
public partial class SettingsPage : IHavePassword
|
||||||
{
|
{
|
||||||
public SettingsPage()
|
public SettingsPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetPassword()
|
||||||
|
{
|
||||||
|
return PBox.Password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPassword(string password)
|
||||||
|
{
|
||||||
|
PBox.Password = password;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user