2016-05-03 00:50:16 +03:00
|
|
|
|
using System;
|
|
|
|
|
using Bit.App.Abstractions;
|
2016-05-07 20:42:09 +03:00
|
|
|
|
using Bit.App.Resources;
|
2016-05-03 00:50:16 +03:00
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
using XLabs.Ioc;
|
|
|
|
|
|
|
|
|
|
namespace Bit.App.Pages
|
|
|
|
|
{
|
|
|
|
|
public class SettingsPage : ContentPage
|
|
|
|
|
{
|
2016-05-08 07:28:14 +03:00
|
|
|
|
private readonly IAuthService _authService;
|
2016-05-03 00:50:16 +03:00
|
|
|
|
|
|
|
|
|
public SettingsPage()
|
|
|
|
|
{
|
2016-05-08 07:28:14 +03:00
|
|
|
|
_authService = Resolver.Resolve<IAuthService>();
|
|
|
|
|
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Init()
|
|
|
|
|
{
|
|
|
|
|
var foldersLayout = new StackLayout { Orientation = StackOrientation.Horizontal };
|
|
|
|
|
foldersLayout.Children.Add(new Label
|
|
|
|
|
{
|
|
|
|
|
Text = "Folders",
|
|
|
|
|
HorizontalOptions = LayoutOptions.StartAndExpand,
|
|
|
|
|
VerticalOptions = LayoutOptions.Center,
|
|
|
|
|
Margin = new Thickness(10, 0, 0, 0)
|
|
|
|
|
});
|
|
|
|
|
foldersLayout.Children.Add(new Image
|
|
|
|
|
{
|
|
|
|
|
Source = ImageSource.FromFile("ion-chevron-right.png"),
|
|
|
|
|
Opacity = 0.3,
|
|
|
|
|
HorizontalOptions = LayoutOptions.End,
|
|
|
|
|
VerticalOptions = LayoutOptions.Center,
|
|
|
|
|
Margin = new Thickness(0, 0, 10, 0)
|
|
|
|
|
});
|
|
|
|
|
var foldersCell = new ViewCell { View = foldersLayout };
|
|
|
|
|
foldersCell.Tapped += FoldersCell_Tapped;
|
|
|
|
|
|
|
|
|
|
var table = new TableView
|
|
|
|
|
{
|
|
|
|
|
Root = new TableRoot
|
|
|
|
|
{
|
|
|
|
|
new TableSection("Manage Folders")
|
|
|
|
|
{
|
|
|
|
|
foldersCell
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2016-05-03 00:50:16 +03:00
|
|
|
|
|
|
|
|
|
var logoutButton = new Button
|
|
|
|
|
{
|
2016-05-07 20:42:09 +03:00
|
|
|
|
Text = AppResources.LogOut,
|
2016-05-03 00:50:16 +03:00
|
|
|
|
Command = new Command(() =>
|
|
|
|
|
{
|
2016-05-08 07:28:14 +03:00
|
|
|
|
_authService.LogOut();
|
2016-05-03 00:50:16 +03:00
|
|
|
|
Application.Current.MainPage = new LoginNavigationPage();
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var stackLayout = new StackLayout { };
|
2016-05-08 07:28:14 +03:00
|
|
|
|
stackLayout.Children.Add(table);
|
2016-05-03 00:50:16 +03:00
|
|
|
|
stackLayout.Children.Add(logoutButton);
|
|
|
|
|
|
2016-05-07 20:42:09 +03:00
|
|
|
|
Title = AppResources.Settings;
|
2016-05-03 00:50:16 +03:00
|
|
|
|
Content = stackLayout;
|
|
|
|
|
}
|
2016-05-08 07:28:14 +03:00
|
|
|
|
|
|
|
|
|
private void FoldersCell_Tapped(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2016-05-03 00:50:16 +03:00
|
|
|
|
}
|
|
|
|
|
}
|