Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaexplorer74 committed Feb 3, 2022
1 parent 8fe43c6 commit 8c8f534
Show file tree
Hide file tree
Showing 79 changed files with 1,042 additions and 15 deletions.
30 changes: 30 additions & 0 deletions MSTodo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ VisualStudioVersion = 17.1.32120.378
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSTodo", "MSTodo\MSTodo.csproj", "{C694E262-AE4D-4174-81D4-FD85547BD16E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo.Core", "Todo.Core\Todo.Core.csproj", "{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Debug|Any CPU.ActiveCfg = Debug|x64
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Debug|Any CPU.Build.0 = Debug|x64
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Debug|Any CPU.Deploy.0 = Debug|x64
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Debug|ARM.ActiveCfg = Debug|ARM
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Debug|ARM.Build.0 = Debug|ARM
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Debug|ARM.Deploy.0 = Debug|ARM
Expand All @@ -29,6 +36,9 @@ Global
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Debug|x86.ActiveCfg = Debug|x86
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Debug|x86.Build.0 = Debug|x86
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Debug|x86.Deploy.0 = Debug|x86
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Release|Any CPU.ActiveCfg = Release|x64
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Release|Any CPU.Build.0 = Release|x64
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Release|Any CPU.Deploy.0 = Release|x64
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Release|ARM.ActiveCfg = Release|ARM
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Release|ARM.Build.0 = Release|ARM
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Release|ARM.Deploy.0 = Release|ARM
Expand All @@ -41,6 +51,26 @@ Global
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Release|x86.ActiveCfg = Release|x86
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Release|x86.Build.0 = Release|x86
{C694E262-AE4D-4174-81D4-FD85547BD16E}.Release|x86.Deploy.0 = Release|x86
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|ARM.ActiveCfg = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|ARM.Build.0 = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|ARM64.Build.0 = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|x64.ActiveCfg = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|x64.Build.0 = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|x86.ActiveCfg = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Debug|x86.Build.0 = Debug|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|Any CPU.Build.0 = Release|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|ARM.ActiveCfg = Release|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|ARM.Build.0 = Release|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|ARM64.ActiveCfg = Release|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|ARM64.Build.0 = Release|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|x64.ActiveCfg = Release|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|x64.Build.0 = Release|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|x86.ActiveCfg = Release|Any CPU
{71F79181-14E3-4ED0-AEFA-E333D7E9E1C8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
13 changes: 12 additions & 1 deletion MSTodo/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
// App

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -14,6 +16,7 @@
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Microsoft.EntityFrameworkCore;

namespace MSTodo
{
Expand All @@ -22,6 +25,8 @@ namespace MSTodo
/// </summary>
sealed partial class App : Application
{


/// <summary>
/// Инициализирует одноэлементный объект приложения. Это первая выполняемая строка разрабатываемого
/// кода, поэтому она является логическим эквивалентом main() или WinMain().
Expand All @@ -30,6 +35,12 @@ public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;

// new =)
using (var db = new MobileContext())
{
db.Database.Migrate();
}
}

/// <summary>
Expand Down
Binary file added MSTodo/Assets/LargeTile.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/LargeTile.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/LargeTile.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/LargeTile.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/LargeTile.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/SmallTile.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/SmallTile.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/SmallTile.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/SmallTile.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/SmallTile.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/SplashScreen.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/SplashScreen.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/SplashScreen.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified MSTodo/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/SplashScreen.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/Square150x150Logo.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/Square150x150Logo.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/Square150x150Logo.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified MSTodo/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/Square150x150Logo.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MSTodo/Assets/Square44x44Logo.scale-100.png
Binary file added MSTodo/Assets/Square44x44Logo.scale-125.png
Binary file added MSTodo/Assets/Square44x44Logo.scale-150.png
Binary file modified MSTodo/Assets/Square44x44Logo.scale-200.png
Binary file added MSTodo/Assets/Square44x44Logo.scale-400.png
Binary file added MSTodo/Assets/Square44x44Logo.targetsize-16.png
Binary file added MSTodo/Assets/Square44x44Logo.targetsize-24.png
Binary file modified MSTodo/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Binary file added MSTodo/Assets/Square44x44Logo.targetsize-256.png
Binary file added MSTodo/Assets/Square44x44Logo.targetsize-32.png
Binary file added MSTodo/Assets/Square44x44Logo.targetsize-48.png
Binary file added MSTodo/Assets/StoreLogo.backup.png
Binary file added MSTodo/Assets/StoreLogo.scale-100.png
Binary file added MSTodo/Assets/StoreLogo.scale-125.png
Binary file added MSTodo/Assets/StoreLogo.scale-150.png
Binary file added MSTodo/Assets/StoreLogo.scale-200.png
Binary file added MSTodo/Assets/StoreLogo.scale-400.png
Binary file added MSTodo/Assets/Wide310x150Logo.scale-100.png
Binary file added MSTodo/Assets/Wide310x150Logo.scale-125.png
Binary file added MSTodo/Assets/Wide310x150Logo.scale-150.png
Binary file modified MSTodo/Assets/Wide310x150Logo.scale-200.png
Binary file added MSTodo/Assets/Wide310x150Logo.scale-400.png
26 changes: 26 additions & 0 deletions MSTodo/Auth/TodoCliAuthenticationProviderFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Graph;
using Microsoft.Graph.Auth;
using Microsoft.Identity.Client;

namespace Todo.CLI.Auth
{
static class TodoCliAuthenticationProviderFactory
{
public static IAuthenticationProvider GetAuthenticationProvider(IServiceProvider factory)
{
var config = (TodoCliConfiguration)factory.GetService(typeof(TodoCliConfiguration));

IPublicClientApplication app = PublicClientApplicationBuilder
.Create(config.ClientId)
.WithRedirectUri("http://localhost") // Only loopback redirect uri is supported, see https://aka.ms/msal-net-os-browser for details
.Build();

TokenCacheHelper.EnableSerialization(app.UserTokenCache);

return new InteractiveAuthenticationProvider(app, config.Scopes);
}
}
}
55 changes: 55 additions & 0 deletions MSTodo/Auth/TokenCacheHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Microsoft.Identity.Client;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;

namespace Todo.CLI.Auth
{
static class TokenCacheHelper
{
public static void EnableSerialization(ITokenCache tokenCache)
{
tokenCache.SetBeforeAccess(BeforeAccessNotification);
tokenCache.SetAfterAccess(AfterAccessNotification);
}

/// <summary>
/// Path to the token cache
/// </summary>
public static readonly string CacheFilePath = System.Reflection.Assembly.GetExecutingAssembly().Location + ".msalcache.bin3";

private static readonly object FileLock = new object();


private static void BeforeAccessNotification(TokenCacheNotificationArgs args)
{
lock (FileLock)
{
args.TokenCache.DeserializeMsalV3(File.Exists(CacheFilePath)
? ProtectedData.Unprotect(File.ReadAllBytes(CacheFilePath),
null,
DataProtectionScope.CurrentUser)
: null);
}
}

private static void AfterAccessNotification(TokenCacheNotificationArgs args)
{
// if the access operation resulted in a cache update
if (args.HasStateChanged)
{
lock (FileLock)
{
// reflect changesgs in the persistent store
File.WriteAllBytes(CacheFilePath,
ProtectedData.Protect(args.TokenCache.SerializeMsalV3(),
null,
DataProtectionScope.CurrentUser)
);
}
}
}
}
}
34 changes: 34 additions & 0 deletions MSTodo/Commands/AddCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// AddCommand

using System;
using System.Collections.Generic;
//using System.CommandLine;
using System.Text;
using Todo.CLI.Handlers;
//using Microsoft.Graph;

namespace Todo.CLI.Commands
{
/*
public class AddCommand : Command
{
public AddCommand(IServiceProvider serviceProvider) : base("add")
{
Description = "Adds a to do item.";
AddArgument(GetSubjectArgument());
Handler = AddCommandHandler.Create(serviceProvider);
}
private Argument GetSubjectArgument()
{
return new Argument("subject")
{
Description = "The subject of the new to do item.",
ArgumentType = typeof(string)
};
}
}
*/
}
27 changes: 27 additions & 0 deletions MSTodo/Commands/CompleteCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
//using System.CommandLine;
using Todo.CLI.Handlers;
using Todo.Core;
using Todo.Core.Model;

namespace Todo.CLI.Commands
{
/*
public class CompleteCommand : Command
{
public CompleteCommand(IServiceProvider serviceProvider) : base("complete")
{
Description = "Completes a to do item.";
AddOption(GetItemOption());
Handler = CompleteCommandHandler.Create(serviceProvider);
}
private Option GetItemOption()
{
return new Option(new string[] { "id", "item-id" }, "The unique identifier of the todo item to complete.");
}
}
*/
}
33 changes: 33 additions & 0 deletions MSTodo/Commands/ListCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
//using System.CommandLine;
using Todo.CLI.Handlers;
using Todo.Core;

namespace Todo.CLI.Commands
{
/*
public class ListCommand : Command
{
public ListCommand(IServiceProvider serviceProvider) : base("list")
{
Description = "Retrieves a list of the to do items.";
AddOption(GetAllOption());
AddOption(GetNoStatusOption());
Handler = ListCommandHandler.Create(serviceProvider);
}
private Option GetAllOption()
{
return new Option(new string[] { "-a", "--all" }, "Lists all to do items including the completed ones.");
}
private Option GetNoStatusOption()
{
return new Option(new string[] { "--no-status" }, "Suppresses the bullet indicating whether the item is completed or not.");
}
}
*/
}
19 changes: 19 additions & 0 deletions MSTodo/Commands/RemoveCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
//using System.CommandLine;
using Todo.CLI.Handlers;
using Todo.Core;
using Todo.Core.Model;

namespace Todo.CLI.Commands
{
/*
public class RemoveCommand : Command
{
public RemoveCommand(IServiceProvider serviceProvider) : base("remove")
{
Description = "Deletes a to do item.";
Handler = RemoveCommandHandler.Create(serviceProvider);
}
}
*/
}
40 changes: 40 additions & 0 deletions MSTodo/Commands/TodoCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Todo.CLI.Handlers;
using System;
//using System.CommandLine;
//using System.CommandLine.Invocation;
using System.IO;
using System.Reflection;

namespace Todo.CLI.Commands
{
/*
public class TodoCommand : RootCommand
{
public TodoCommand(IServiceProvider serviceProvider)
{
// Add static parameters
Description = "A CLI to manage Microsoft to do items.";
// Add options
AddOption(GetVersionOption());
// Add handlers
Handler = TodoCommandHandler.Create();
// Add subcommands
AddCommand(new AddCommand(serviceProvider));
AddCommand(new ListCommand(serviceProvider));
AddCommand(new CompleteCommand(serviceProvider));
AddCommand(new RemoveCommand(serviceProvider));
}
private Option GetVersionOption()
{
return new Option(new string[] { "-v", "--version" }, "Prints out the todo CLI version.")
{
Argument = new Argument<bool>()
};
}
}
*/
}
22 changes: 22 additions & 0 deletions MSTodo/CompanyPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Page
x:Class="MSTodo.CompanyPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MSTodo"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Margin="10 0 10 0">
<TextBlock x:Name="headerBlock" Text = "Добавление компании"
Style="{ThemeResource HeaderTextBlockStyle}" />
<TextBlock>Название компании</TextBlock>
<TextBox x:Name="nameBox" />
<StackPanel Orientation="Horizontal">
<Button Content="Сохранить" Click="Save_Click" Margin="10" />
<Button Content="Отмена" Click="Cancel_Click" Margin="10" />
</StackPanel>
</StackPanel>
</Grid>
</Page>
Loading

0 comments on commit 8c8f534

Please sign in to comment.