Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

Commit 4efd23a

Browse files
committed
Added MvxTabBarPresenter with sample
1 parent 22876e0 commit 4efd23a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2368
-465
lines changed

.gitattributes

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This file is understood by git 1.7.2+.
2+
3+
# Windows specific files should always be crlf on checkout
4+
*.bat text eol=crlf
5+
*.cmd text eol=crlf
6+
*.ps1 text eol=crlf
7+
8+
# Check out the following as ln always for osx/linux/cygwin
9+
*.sh text eol=lf
10+
11+
# Opt in the following types to always normalize line endings
12+
# on checkin and always use native endings on checkout.
13+
*.config text
14+
*.cs text diff=csharp
15+
*.csproj text
16+
*.md text
17+
*.msbuild text
18+
*.nuspec text
19+
*.pp text
20+
*.ps1 text
21+
*.sln text
22+
*.tt text
23+
*.txt text
24+
*.xaml text
25+
*.xml text
26+
27+
# Binary files
28+
*.bmp binary
29+
*.jpeg binary
30+
*.jpg binary
31+
*.nupkg binary
32+
*.png binary
33+
*.sdf binary
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using MvvmCross.Core.ViewModels;
3+
4+
namespace MvvmCross.iOS.Support.Tabs.Core
5+
{
6+
public class App : MvxApplication
7+
{
8+
public App()
9+
{
10+
}
11+
12+
public override void Initialize()
13+
{
14+
base.Initialize();
15+
16+
this.RegisterAppStart(new AppStart());
17+
}
18+
}
19+
}
20+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using MvvmCross.Core.ViewModels;
3+
using Plugin.Settings;
4+
using MvvmCross.iOS.Support.Tabs.Core.Helpers;
5+
using MvvmCross.iOS.Support.Tabs.Core.ViewModels;
6+
7+
namespace MvvmCross.iOS.Support.Tabs.Core
8+
{
9+
public class AppStart : MvxNavigatingObject, IMvxAppStart
10+
{
11+
public void Start(object hint = null)
12+
{
13+
if(!string.IsNullOrEmpty(CrossSettings.Current.GetValueOrDefault<string>(Settings.TokenKey)))
14+
{
15+
ShowViewModel<MainViewModel>();
16+
}
17+
else
18+
{
19+
ShowViewModel<LoginViewModel>();
20+
}
21+
}
22+
}
23+
}
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Helpers/Settings.cs
2+
using Plugin.Settings;
3+
using Plugin.Settings.Abstractions;
4+
5+
namespace MvvmCross.iOS.Support.Tabs.Core.Helpers
6+
{
7+
/// <summary>
8+
/// This is the Settings static class that can be used in your Core solution or in any
9+
/// of your client applications. All settings are laid out the same exact way with getters
10+
/// and setters.
11+
/// </summary>
12+
public static class Settings
13+
{
14+
public const string TokenKey = "token";
15+
16+
private static ISettings AppSettings
17+
{
18+
get
19+
{
20+
return CrossSettings.Current;
21+
}
22+
}
23+
24+
#region Setting Constants
25+
26+
private const string SettingsKey = "settings_key";
27+
private static readonly string SettingsDefault = string.Empty;
28+
29+
#endregion
30+
31+
32+
public static string GeneralSettings
33+
{
34+
get
35+
{
36+
return AppSettings.GetValueOrDefault<string>(SettingsKey, SettingsDefault);
37+
}
38+
set
39+
{
40+
AppSettings.AddOrUpdateValue<string>(SettingsKey, value);
41+
}
42+
}
43+
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{5FB086C9-CA74-45CC-86CC-8DD523DCE004}</ProjectGuid>
7+
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<UseMSBuildEngine>true</UseMSBuildEngine>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>MvvmCross.iOS.Support.Tabs.Core</RootNamespace>
11+
<AssemblyName>MvvmCross.iOS.Support.Tabs.Core</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug</OutputPath>
20+
<DefineConstants>DEBUG;</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
<ConsolePause>false</ConsolePause>
24+
<NoStdLib>false</NoStdLib>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release</OutputPath>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
<ConsolePause>false</ConsolePause>
32+
<NoStdLib>false</NoStdLib>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Compile Include="MyClass.cs" />
36+
<Compile Include="Properties\AssemblyInfo.cs" />
37+
<Compile Include="App.cs" />
38+
<Compile Include="AppStart.cs" />
39+
<Compile Include="Helpers\Settings.cs" />
40+
<Compile Include="ViewModels\MainViewModel.cs" />
41+
<Compile Include="ViewModels\LoginViewModel.cs" />
42+
<Compile Include="ViewModels\RegisterViewModel.cs" />
43+
<Compile Include="ViewModels\Tab1ViewModel.cs" />
44+
<Compile Include="ViewModels\Tab2ViewModel.cs" />
45+
<Compile Include="ViewModels\TabChildViewModel.cs" />
46+
<Compile Include="ViewModels\ModalViewModel.cs" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<Reference Include="MvvmCross.Platform">
50+
<HintPath>..\packages\MvvmCross.Platform.4.2.3\lib\portable-net45+win+wpa81+wp80\MvvmCross.Platform.dll</HintPath>
51+
</Reference>
52+
<Reference Include="MvvmCross.Core">
53+
<HintPath>..\packages\MvvmCross.Core.4.2.3\lib\portable-net45+win+wpa81+wp80\MvvmCross.Core.dll</HintPath>
54+
</Reference>
55+
<Reference Include="MvvmCross.Binding">
56+
<HintPath>..\packages\MvvmCross.Binding.4.2.3\lib\portable-net45+win+wpa81+wp80\MvvmCross.Binding.dll</HintPath>
57+
</Reference>
58+
<Reference Include="MvvmCross.Localization">
59+
<HintPath>..\packages\MvvmCross.Binding.4.2.3\lib\portable-net45+win+wpa81+wp80\MvvmCross.Localization.dll</HintPath>
60+
</Reference>
61+
<Reference Include="Plugin.Settings">
62+
<HintPath>..\packages\Xam.Plugins.Settings.2.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Settings.dll</HintPath>
63+
</Reference>
64+
<Reference Include="Plugin.Settings.Abstractions">
65+
<HintPath>..\packages\Xam.Plugins.Settings.2.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Settings.Abstractions.dll</HintPath>
66+
</Reference>
67+
</ItemGroup>
68+
<ItemGroup>
69+
<None Include="packages.config" />
70+
</ItemGroup>
71+
<ItemGroup>
72+
<Folder Include="ViewModels\" />
73+
</ItemGroup>
74+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
75+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using Foundation;
2+
using UIKit;
3+
using MvvmCross.iOS.Support.Presenters;
4+
using MvvmCross.iOS.Platform;
5+
using MvvmCross.Platform;
6+
using MvvmCross.Core.ViewModels;
7+
8+
namespace MvvmCross.iOS.Support.Tabs.iOS
9+
{
10+
// The UIApplicationDelegate for the application. This class is responsible for launching the
11+
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
12+
[Register("AppDelegate")]
13+
public class AppDelegate : MvxApplicationDelegate
14+
{
15+
public override UIWindow Window { get; set; }
16+
17+
public MvxTabsViewPresenter Presenter { get; set; }
18+
19+
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
20+
{
21+
// Override point for customization after application launch.
22+
// If not required for your application you can safely delete this method
23+
24+
Window = new UIWindow(UIScreen.MainScreen.Bounds);
25+
Window.BackgroundColor = UIColor.White;
26+
27+
Presenter = new MvxTabsViewPresenter(this, this.Window);
28+
29+
var setup = new Setup(this, this.Presenter);
30+
setup.Initialize();
31+
32+
Mvx.Resolve<IMvxAppStart>().Start();
33+
34+
Window.MakeKeyAndVisible();
35+
36+
return true;
37+
}
38+
39+
public override void OnResignActivation(UIApplication application)
40+
{
41+
// Invoked when the application is about to move from active to inactive state.
42+
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
43+
// or when the user quits the application and it begins the transition to the background state.
44+
// Games should use this method to pause the game.
45+
}
46+
47+
public override void DidEnterBackground(UIApplication application)
48+
{
49+
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
50+
// If your application supports background exection this method is called instead of WillTerminate when the user quits.
51+
}
52+
53+
public override void WillEnterForeground(UIApplication application)
54+
{
55+
// Called as part of the transiton from background to active state.
56+
// Here you can undo many of the changes made on entering the background.
57+
}
58+
59+
public override void OnActivated(UIApplication application)
60+
{
61+
// Restart any tasks that were paused (or not yet started) while the application was inactive.
62+
// If the application was previously in the background, optionally refresh the user interface.
63+
}
64+
65+
public override void WillTerminate(UIApplication application)
66+
{
67+
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
68+
}
69+
}
70+
}
71+
72+

0 commit comments

Comments
 (0)