-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fe43c6
commit 8c8f534
Showing
79 changed files
with
1,042 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
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.
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
BIN
+512 Bytes
MSTodo/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.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
BIN
+713 Bytes
MSTodo/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.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
BIN
+6.19 KB
MSTodo/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.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
BIN
+809 Bytes
MSTodo/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.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
BIN
+1.06 KB
MSTodo/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file modified
BIN
+0 Bytes
(100%)
MSTodo/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}; | ||
} | ||
} | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | ||
} | ||
} | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | ||
} | ||
} | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>() | ||
}; | ||
} | ||
} | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.