├── .gitignore
├── LICENSE.txt
├── O365-APIs-Start-Windows.sln
├── Office365StarterProject
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── CalendarIcon.png
│ ├── ContactsIcon.png
│ ├── EmailIcon.png
│ ├── Logo.scale-100.png
│ ├── Logo310x150.png
│ ├── Logo310x310.png
│ ├── Logo70x70.png
│ ├── MyFilesIcon.png
│ ├── SmallLogo.scale-100.png
│ ├── SplashScreen.scale-100.png
│ ├── Square310x310Logo.scale-100.png
│ ├── Square70x70Logo.scale-100.png
│ ├── StoreLogo.scale-100.png
│ ├── UserDefault.png
│ ├── UserDefaultSignedIn.png
│ └── Wide310x150Logo.scale-100.png
├── Common
│ ├── BooleanToVisibilityConverter.cs
│ ├── NavigationHelper.cs
│ ├── ObservableDictionary.cs
│ ├── RelayCommand.cs
│ └── SuspensionManager.cs
├── Helpers
│ ├── AuthenticationHelper.cs
│ ├── CalendarOperations.cs
│ ├── ContactsOperations.cs
│ ├── DiscoveryServiceCache.cs
│ ├── Extensions.cs
│ ├── FileOperations.cs
│ ├── MailOperations.cs
│ ├── MessageDialogHelper.cs
│ └── UserOperations.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── Office365Starter.csproj
├── Package.appxmanifest
├── Properties
│ └── AssemblyInfo.cs
├── ViewModels
│ ├── CalendarViewModel.cs
│ ├── ContactItemViewModel.cs
│ ├── ContactsViewModel.cs
│ ├── EventViewModel.cs
│ ├── FileSystemItemViewModel.cs
│ ├── FilesViewModel.cs
│ ├── LoggingViewModel.cs
│ ├── MailItemViewModel.cs
│ ├── MailViewModel.cs
│ ├── UserViewModel.cs
│ └── ViewModelBase.cs
├── Views
│ ├── Calendar.xaml
│ ├── Calendar.xaml.cs
│ ├── Contacts.xaml
│ ├── Contacts.xaml.cs
│ ├── Mail.xaml
│ ├── Mail.xaml.cs
│ ├── MyFiles.xaml
│ └── MyFiles.xaml.cs
└── packages.config
├── README.md
└── loc
└── README-ja-JP.md
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 |
9 | # Build results
10 | [Dd]ebug/
11 | [Dd]ebugPublic/
12 | [Rr]elease/
13 | x64/
14 | build/
15 | bld/
16 | [Bb]in/
17 | [Oo]bj/
18 |
19 | # MSTest test Results
20 | [Tt]est[Rr]esult*/
21 | [Bb]uild[Ll]og.*
22 |
23 | #NUNIT
24 | *.VisualState.xml
25 | TestResult.xml
26 |
27 | # Build Results of an ATL Project
28 | [Dd]ebugPS/
29 | [Rr]eleasePS/
30 | dlldata.c
31 |
32 | *_i.c
33 | *_p.c
34 | *_i.h
35 | *.ilk
36 | *.meta
37 | *.obj
38 | *.pch
39 | *.pdb
40 | *.pgc
41 | *.pgd
42 | *.rsp
43 | *.sbr
44 | *.tlb
45 | *.tli
46 | *.tlh
47 | *.tmp
48 | *.tmp_proj
49 | *.log
50 | *.vspscc
51 | *.vssscc
52 | .builds
53 | *.pidb
54 | *.svclog
55 | *.scc
56 |
57 | # Chutzpah Test files
58 | _Chutzpah*
59 |
60 | # Visual C++ cache files
61 | ipch/
62 | *.aps
63 | *.ncb
64 | *.opensdf
65 | *.sdf
66 | *.cachefile
67 |
68 | # Visual Studio profiler
69 | *.psess
70 | *.vsp
71 | *.vspx
72 |
73 | # TFS 2012 Local Workspace
74 | $tf/
75 |
76 | # Guidance Automation Toolkit
77 | *.gpState
78 |
79 | # ReSharper is a .NET coding add-in
80 | _ReSharper*/
81 | *.[Rr]e[Ss]harper
82 | *.DotSettings.user
83 |
84 | # JustCode is a .NET coding addin-in
85 | .JustCode
86 |
87 | # TeamCity is a build add-in
88 | _TeamCity*
89 |
90 | # DotCover is a Code Coverage Tool
91 | *.dotCover
92 |
93 | # NCrunch
94 | *.ncrunch*
95 | _NCrunch_*
96 | .*crunch*.local.xml
97 |
98 | # MightyMoose
99 | *.mm.*
100 | AutoTest.Net/
101 |
102 | # Web workbench (sass)
103 | .sass-cache/
104 |
105 | # Installshield output folder
106 | [Ee]xpress/
107 |
108 | # DocProject is a documentation generator add-in
109 | DocProject/buildhelp/
110 | DocProject/Help/*.HxT
111 | DocProject/Help/*.HxC
112 | DocProject/Help/*.hhc
113 | DocProject/Help/*.hhk
114 | DocProject/Help/*.hhp
115 | DocProject/Help/Html2
116 | DocProject/Help/html
117 |
118 | # Click-Once directory
119 | publish/
120 |
121 | # Publish Web Output
122 | *.[Pp]ublish.xml
123 | *.azurePubxml
124 |
125 | # NuGet Packages Directory
126 | packages/
127 | ## TODO: If the tool you use requires repositories.config uncomment the next line
128 | #!packages/repositories.config
129 |
130 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
131 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented)
132 | !packages/build/
133 |
134 | # Windows Azure Build Output
135 | csx/
136 | *.build.csdef
137 |
138 | # Windows Store app package directory
139 | AppPackages/
140 |
141 | # Others
142 | sql/
143 | *.Cache
144 | ClientBin/
145 | [Ss]tyle[Cc]op.*
146 | ~$*
147 | *~
148 | *.dbmdl
149 | *.dbproj.schemaview
150 | *.pfx
151 | *.publishsettings
152 | node_modules/
153 |
154 | # RIA/Silverlight projects
155 | Generated_Code/
156 |
157 | # Backup & report files from converting an old project file to a newer
158 | # Visual Studio version. Backup files are not needed, because we have git ;-)
159 | _UpgradeReport_Files/
160 | Backup*/
161 | UpgradeLog*.XML
162 | UpgradeLog*.htm
163 |
164 | # SQL Server files
165 | *.mdf
166 | *.ldf
167 |
168 | # Business Intelligence projects
169 | *.rdl.data
170 | *.bim.layout
171 | *.bim_*.settings
172 |
173 | # Microsoft Fakes
174 | FakesAssemblies/
175 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | O365-APIs-Start-Windows, https://github.com/OfficeDev/Office-365-APIs-Starter-Project-for-Windows
2 |
3 | Copyright (c) Microsoft Corporation
4 | All rights reserved.
5 |
6 | MIT License:
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining
9 | a copy of this software and associated documentation files (the
10 | ""Software""), to deal in the Software without restriction, including
11 | without limitation the rights to use, copy, modify, merge, publish,
12 | distribute, sublicense, and/or sell copies of the Software, and to
13 | permit persons to whom the Software is furnished to do so, subject to
14 | the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be
17 | included in all copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 |
--------------------------------------------------------------------------------
/O365-APIs-Start-Windows.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.30723.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Office365Starter", "Office365StarterProject\Office365Starter.csproj", "{52E95C2D-A5EF-468C-8D59-5E5DB61704CC}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|ARM = Debug|ARM
12 | Debug|x64 = Debug|x64
13 | Debug|x86 = Debug|x86
14 | Release|Any CPU = Release|Any CPU
15 | Release|ARM = Release|ARM
16 | Release|x64 = Release|x64
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
23 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|ARM.ActiveCfg = Debug|ARM
24 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|ARM.Build.0 = Debug|ARM
25 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|ARM.Deploy.0 = Debug|ARM
26 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|x64.ActiveCfg = Debug|x64
27 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|x64.Build.0 = Debug|x64
28 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|x64.Deploy.0 = Debug|x64
29 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|x86.ActiveCfg = Debug|x86
30 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|x86.Build.0 = Debug|x86
31 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Debug|x86.Deploy.0 = Debug|x86
32 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|Any CPU.Deploy.0 = Release|Any CPU
35 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|ARM.ActiveCfg = Release|ARM
36 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|ARM.Build.0 = Release|ARM
37 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|ARM.Deploy.0 = Release|ARM
38 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|x64.ActiveCfg = Release|x64
39 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|x64.Build.0 = Release|x64
40 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|x64.Deploy.0 = Release|x64
41 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|x86.ActiveCfg = Release|x86
42 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|x86.Build.0 = Release|x86
43 | {52E95C2D-A5EF-468C-8D59-5E5DB61704CC}.Release|x86.Deploy.0 = Release|x86
44 | EndGlobalSection
45 | GlobalSection(SolutionProperties) = preSolution
46 | HideSolutionNode = FALSE
47 | EndGlobalSection
48 | EndGlobal
49 |
--------------------------------------------------------------------------------
/Office365StarterProject/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 | White
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Office365StarterProject/App.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
2 |
3 | using Office365StarterProject.ViewModels;
4 | using System;
5 | using Windows.ApplicationModel;
6 | using Windows.ApplicationModel.Activation;
7 | using Windows.UI.Xaml;
8 | using Windows.UI.Xaml.Controls;
9 | using Windows.UI.Xaml.Navigation;
10 |
11 | // The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
12 | namespace Office365StarterProject
13 | {
14 | ///
15 | /// Provides application-specific behavior to supplement the default Application class.
16 | ///
17 | sealed partial class App : Application
18 | {
19 | ///
20 | /// Represents the current user of the sample.
21 | ///
22 | private static UserViewModel _currentUser;
23 | public static UserViewModel CurrentUser
24 | {
25 | get
26 | {
27 | if (_currentUser == null)
28 | {
29 | _currentUser = new UserViewModel();
30 | }
31 | return _currentUser;
32 | }
33 | }
34 | ///
35 | /// Initializes the singleton application object. This is the first line of authored code
36 | /// executed, and as such is the logical equivalent of main() or WinMain().
37 | ///
38 | public App()
39 | {
40 | this.InitializeComponent();
41 | this.Suspending += OnSuspending;
42 | }
43 |
44 | ///
45 | /// Invoked when the application is launched normally by the end user. Other entry points
46 | /// will be used such as when the application is launched to open a specific file.
47 | ///
48 | /// Details about the launch request and process.
49 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")]
50 | protected override void OnLaunched(LaunchActivatedEventArgs e)
51 | {
52 |
53 | #if DEBUG
54 | if (System.Diagnostics.Debugger.IsAttached)
55 | {
56 | this.DebugSettings.EnableFrameRateCounter = false;
57 | }
58 | #endif
59 |
60 | Frame rootFrame = Window.Current.Content as Frame;
61 |
62 | // Do not repeat app initialization when the Window already has content,
63 | // just ensure that the window is active
64 | if (rootFrame == null)
65 | {
66 | // Create a Frame to act as the navigation context and navigate to the first page
67 | rootFrame = new Frame();
68 | // Set the default language
69 | rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
70 |
71 | rootFrame.NavigationFailed += OnNavigationFailed;
72 |
73 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
74 | {
75 | //TODO: Load state from previously suspended application
76 | }
77 |
78 | // Place the frame in the current Window
79 | Window.Current.Content = rootFrame;
80 | }
81 |
82 | if (rootFrame.Content == null)
83 | {
84 | // When the navigation stack isn't restored navigate to the first page,
85 | // configuring the new page by passing required information as a navigation
86 | // parameter
87 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
88 | }
89 | // Ensure the current window is active
90 | Window.Current.Activate();
91 | }
92 |
93 | ///
94 | /// Invoked when Navigation to a certain page fails
95 | ///
96 | /// The Frame which failed navigation
97 | /// Details about the navigation failure
98 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
99 | {
100 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
101 | }
102 |
103 | ///
104 | /// Invoked when application execution is being suspended. Application state is saved
105 | /// without knowing whether the application will be terminated or resumed with the contents
106 | /// of memory still intact.
107 | ///
108 | /// The source of the suspend request.
109 | /// Details about the suspend request.
110 | private void OnSuspending(object sender, SuspendingEventArgs e)
111 | {
112 | var deferral = e.SuspendingOperation.GetDeferral();
113 | //TODO: Save application state and stop any background activity
114 | deferral.Complete();
115 | }
116 | }
117 | }
118 | //*********************************************************
119 | //
120 | // MIT License:
121 | // Permission is hereby granted, free of charge, to any person obtaining
122 | // a copy of this software and associated documentation files (the
123 | // ""Software""), to deal in the Software without restriction, including
124 | // without limitation the rights to use, copy, modify, merge, publish,
125 | // distribute, sublicense, and/or sell copies of the Software, and to
126 | // permit persons to whom the Software is furnished to do so, subject to
127 | // the following conditions:
128 |
129 | // The above copyright notice and this permission notice shall be
130 | // included in all copies or substantial portions of the Software.
131 |
132 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
133 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
134 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
135 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
136 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
137 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
138 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
139 | //
140 | //*********************************************************
141 |
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/CalendarIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/CalendarIcon.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/ContactsIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/ContactsIcon.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/EmailIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/EmailIcon.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/Logo.scale-100.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/Logo310x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/Logo310x150.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/Logo310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/Logo310x310.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/Logo70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/Logo70x70.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/MyFilesIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/MyFilesIcon.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/SmallLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/SmallLogo.scale-100.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/SplashScreen.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/SplashScreen.scale-100.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/Square310x310Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/Square310x310Logo.scale-100.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/Square70x70Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/Square70x70Logo.scale-100.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/StoreLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/StoreLogo.scale-100.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/UserDefault.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/UserDefault.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/UserDefaultSignedIn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/UserDefaultSignedIn.png
--------------------------------------------------------------------------------
/Office365StarterProject/Assets/Wide310x150Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OfficeDev/O365-Windows-Start/d2ef21ffdedd74cb872f66ce78d4e3b287b2ec40/Office365StarterProject/Assets/Wide310x150Logo.scale-100.png
--------------------------------------------------------------------------------
/Office365StarterProject/Common/BooleanToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Windows.UI.Xaml;
3 | using Windows.UI.Xaml.Data;
4 |
5 | namespace Office365StarterProject.Common
6 | {
7 | ///
8 | /// Value converter that translates true to and false to
9 | /// .
10 | ///
11 | public sealed class BooleanToVisibilityConverter : IValueConverter
12 | {
13 | public object Convert(object value, Type targetType, object parameter, string language)
14 | {
15 | return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
16 | }
17 |
18 | public object ConvertBack(object value, Type targetType, object parameter, string language)
19 | {
20 | return value is Visibility && (Visibility)value == Visibility.Visible;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Office365StarterProject/Common/ObservableDictionary.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Windows.Foundation.Collections;
5 |
6 | namespace Office365StarterProject.Common
7 | {
8 | ///
9 | /// Implementation of IObservableMap that supports reentrancy for use as a default view
10 | /// model.
11 | ///
12 | public class ObservableDictionary : IObservableMap
13 | {
14 | private class ObservableDictionaryChangedEventArgs : IMapChangedEventArgs
15 | {
16 | public ObservableDictionaryChangedEventArgs(CollectionChange change, string key)
17 | {
18 | this.CollectionChange = change;
19 | this.Key = key;
20 | }
21 |
22 | public CollectionChange CollectionChange { get; private set; }
23 | public string Key { get; private set; }
24 | }
25 |
26 | private Dictionary _dictionary = new Dictionary();
27 | public event MapChangedEventHandler MapChanged;
28 |
29 | private void InvokeMapChanged(CollectionChange change, string key)
30 | {
31 | var eventHandler = MapChanged;
32 | if (eventHandler != null)
33 | {
34 | eventHandler(this, new ObservableDictionaryChangedEventArgs(change, key));
35 | }
36 | }
37 |
38 | public void Add(string key, object value)
39 | {
40 | this._dictionary.Add(key, value);
41 | this.InvokeMapChanged(CollectionChange.ItemInserted, key);
42 | }
43 |
44 | public void Add(KeyValuePair item)
45 | {
46 | this.Add(item.Key, item.Value);
47 | }
48 |
49 | public bool Remove(string key)
50 | {
51 | if (this._dictionary.Remove(key))
52 | {
53 | this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
54 | return true;
55 | }
56 | return false;
57 | }
58 |
59 | public bool Remove(KeyValuePair item)
60 | {
61 | object currentValue;
62 | if (this._dictionary.TryGetValue(item.Key, out currentValue) &&
63 | Object.Equals(item.Value, currentValue) && this._dictionary.Remove(item.Key))
64 | {
65 | this.InvokeMapChanged(CollectionChange.ItemRemoved, item.Key);
66 | return true;
67 | }
68 | return false;
69 | }
70 |
71 | public object this[string key]
72 | {
73 | get
74 | {
75 | return this._dictionary[key];
76 | }
77 | set
78 | {
79 | this._dictionary[key] = value;
80 | this.InvokeMapChanged(CollectionChange.ItemChanged, key);
81 | }
82 | }
83 |
84 | public void Clear()
85 | {
86 | var priorKeys = this._dictionary.Keys.ToArray();
87 | this._dictionary.Clear();
88 | foreach (var key in priorKeys)
89 | {
90 | this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
91 | }
92 | }
93 |
94 | public ICollection Keys
95 | {
96 | get { return this._dictionary.Keys; }
97 | }
98 |
99 | public bool ContainsKey(string key)
100 | {
101 | return this._dictionary.ContainsKey(key);
102 | }
103 |
104 | public bool TryGetValue(string key, out object value)
105 | {
106 | return this._dictionary.TryGetValue(key, out value);
107 | }
108 |
109 | public ICollection