diff --git a/1.0/FirstFloor.ModernUI/.editorconfig b/1.0/FirstFloor.ModernUI/.editorconfig new file mode 100644 index 00000000..c0e00365 --- /dev/null +++ b/1.0/FirstFloor.ModernUI/.editorconfig @@ -0,0 +1,6 @@ +[*] +indent_size = 4 +end_of_line = crlf + +[*.xml] +indent_style = space \ No newline at end of file diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/App.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/App.xaml.cs index 0e396c6f..51dbd00d 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/App.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/App.xaml.cs @@ -1,27 +1,27 @@ -using FirstFloor.ModernUI.Presentation; -using FirstFloor.ModernUI.Windows.Controls; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; - -namespace FirstFloor.ModernUI.App -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - /// - /// Raises the event. - /// - /// A that contains the event data. - protected override void OnStartup(StartupEventArgs e) - { - base.OnStartup(e); - } - } -} +using FirstFloor.ModernUI.Presentation; +using FirstFloor.ModernUI.Windows.Controls; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace FirstFloor.ModernUI.App +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + /// + /// Raises the event. + /// + /// A that contains the event data. + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/BingImage.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/BingImage.cs index 012fe02a..5c53d6f6 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/BingImage.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/BingImage.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Xml.Linq; -using System.Xml.XPath; - -namespace FirstFloor.ModernUI.App -{ - /// - /// Provides an attached property determining the current Bing image and assigning it to an image or imagebrush. - /// - public static class BingImage - { - public static readonly DependencyProperty UseBingImageProperty = DependencyProperty.RegisterAttached("UseBingImage", typeof(bool), typeof(BingImage), new PropertyMetadata(OnUseBingImageChanged)); - - private static BitmapImage cachedBingImage; - - private static async void OnUseBingImageChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) - { - var newValue = (bool)e.NewValue; - var image = o as Image; - var imageBrush = o as ImageBrush; - - if (!newValue || (image == null && imageBrush == null)) { - return; - } - - if (cachedBingImage == null) { - var url = await GetCurrentBingImageUrl(); - if (url != null) { - cachedBingImage = new BitmapImage(url); - } - } - - if (cachedBingImage != null){ - if (image != null) { - image.Source = cachedBingImage; - } - else if (imageBrush != null) { - imageBrush.ImageSource = cachedBingImage; - } - } - } - - private static async Task GetCurrentBingImageUrl() - { - var client = new HttpClient(); - var result = await client.GetAsync("http://www.bing.com/hpimagearchive.aspx?format=xml&idx=0&n=2&mbl=1&mkt=en-ww"); - if (result.IsSuccessStatusCode) { - using (var stream = await result.Content.ReadAsStreamAsync()) { - var doc = XDocument.Load(stream); - - var url = (string)doc.XPathSelectElement("/images/image/url"); - - return new Uri(string.Format(CultureInfo.InvariantCulture, "http://bing.com{0}", url), UriKind.Absolute); - } - } - - return null; - } - - - public static bool GetUseBingImage(DependencyObject o) - { - return (bool)o.GetValue(UseBingImageProperty); - } - - public static void SetUseBingImage(DependencyObject o, bool value) - { - o.SetValue(UseBingImageProperty, value); - } - } -} +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Xml.Linq; +using System.Xml.XPath; + +namespace FirstFloor.ModernUI.App +{ + /// + /// Provides an attached property determining the current Bing image and assigning it to an image or imagebrush. + /// + public static class BingImage + { + public static readonly DependencyProperty UseBingImageProperty = DependencyProperty.RegisterAttached("UseBingImage", typeof(bool), typeof(BingImage), new PropertyMetadata(OnUseBingImageChanged)); + + private static BitmapImage cachedBingImage; + + private static async void OnUseBingImageChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + var newValue = (bool)e.NewValue; + var image = o as Image; + var imageBrush = o as ImageBrush; + + if (!newValue || (image == null && imageBrush == null)) { + return; + } + + if (cachedBingImage == null) { + var url = await GetCurrentBingImageUrl(); + if (url != null) { + cachedBingImage = new BitmapImage(url); + } + } + + if (cachedBingImage != null){ + if (image != null) { + image.Source = cachedBingImage; + } + else if (imageBrush != null) { + imageBrush.ImageSource = cachedBingImage; + } + } + } + + private static async Task GetCurrentBingImageUrl() + { + var client = new HttpClient(); + var result = await client.GetAsync("http://www.bing.com/hpimagearchive.aspx?format=xml&idx=0&n=2&mbl=1&mkt=en-ww"); + if (result.IsSuccessStatusCode) { + using (var stream = await result.Content.ReadAsStreamAsync()) { + var doc = XDocument.Load(stream); + + var url = (string)doc.XPathSelectElement("/images/image/url"); + + return new Uri(string.Format(CultureInfo.InvariantCulture, "http://bing.com{0}", url), UriKind.Absolute); + } + } + + return null; + } + + + public static bool GetUseBingImage(DependencyObject o) + { + return (bool)o.GetValue(UseBingImageProperty); + } + + public static void SetUseBingImage(DependencyObject o, bool value) + { + o.SetValue(UseBingImageProperty, value); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ContentLoaderImages.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ContentLoaderImages.xaml.cs index f01aaa2b..24d86673 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ContentLoaderImages.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ContentLoaderImages.xaml.cs @@ -1,47 +1,47 @@ -using FirstFloor.ModernUI.Windows.Controls; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ContentLoaderImages.xaml - /// - public partial class ContentLoaderImages : UserControl - { - public ContentLoaderImages() - { - InitializeComponent(); - - LoadImageLinks(); - } - - private async void LoadImageLinks() - { - var loader = (FlickrImageLoader)Tab.ContentLoader; - - try { - // load image links and assign to tab list - this.Tab.Links = await loader.GetInterestingnessListAsync(); - - // select first link - this.Tab.SelectedSource = this.Tab.Links.Select(l => l.Source).FirstOrDefault(); - } - catch (Exception e) { - ModernDialog.ShowMessage(e.Message, "Failure", MessageBoxButton.OK); - } - } - } -} +using FirstFloor.ModernUI.Windows.Controls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ContentLoaderImages.xaml + /// + public partial class ContentLoaderImages : UserControl + { + public ContentLoaderImages() + { + InitializeComponent(); + + LoadImageLinks(); + } + + private async void LoadImageLinks() + { + var loader = (FlickrImageLoader)Tab.ContentLoader; + + try { + // load image links and assign to tab list + this.Tab.Links = await loader.GetInterestingnessListAsync(); + + // select first link + this.Tab.SelectedSource = this.Tab.Links.Select(l => l.Source).FirstOrDefault(); + } + catch (Exception e) { + ModernDialog.ShowMessage(e.Message, "Failure", MessageBoxButton.OK); + } + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ContentLoaderIntro.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ContentLoaderIntro.xaml.cs index 6bde9564..fc7419d6 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ContentLoaderIntro.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ContentLoaderIntro.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ContentLoaderIntro.xaml - /// - public partial class ContentLoaderIntro : UserControl - { - public ContentLoaderIntro() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ContentLoaderIntro.xaml + /// + public partial class ContentLoaderIntro : UserControl + { + public ContentLoaderIntro() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernBBCodeBlock.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernBBCodeBlock.xaml.cs index e25f6e5b..c6399d5b 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernBBCodeBlock.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernBBCodeBlock.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsModernBBCodeBlock.xaml - /// - public partial class ControlsModernBBCodeBlock : UserControl - { - public ControlsModernBBCodeBlock() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsModernBBCodeBlock.xaml + /// + public partial class ControlsModernBBCodeBlock : UserControl + { + public ControlsModernBBCodeBlock() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernButton.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernButton.xaml.cs index cfba4874..e83fb747 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernButton.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernButton.xaml.cs @@ -1,56 +1,56 @@ -using FirstFloor.ModernUI.Windows.Controls; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Xml.Linq; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsModernButton.xaml - /// - public partial class ControlsModernButton : UserControl - { - public ControlsModernButton() - { - InitializeComponent(); - - // find all embedded XAML icon files - var assembly = GetType().Assembly; - var iconResourceNames = from name in assembly.GetManifestResourceNames() - where name.StartsWith("FirstFloor.ModernUI.App.Assets.appbar.") - select name; - - - foreach (var name in iconResourceNames) { - // load the resource stream - using (var stream = assembly.GetManifestResourceStream(name)) { - // parse the icon data using xml - var doc = XDocument.Load(stream); - - var path = doc.Root.Element("{http://schemas.microsoft.com/winfx/2006/xaml/presentation}Path"); - if (path != null) { - var data = (string)path.Attribute("Data"); - - // create a modern button and add it to the button panel - ButtonPanel.Children.Add(new ModernButton { - IconData = PathGeometry.Parse(data), - Margin = new Thickness(0, 0, 8, 0) - }); - } - } - } - } - } -} +using FirstFloor.ModernUI.Windows.Controls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Xml.Linq; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsModernButton.xaml + /// + public partial class ControlsModernButton : UserControl + { + public ControlsModernButton() + { + InitializeComponent(); + + // find all embedded XAML icon files + var assembly = GetType().Assembly; + var iconResourceNames = from name in assembly.GetManifestResourceNames() + where name.StartsWith("FirstFloor.ModernUI.App.Assets.appbar.") + select name; + + + foreach (var name in iconResourceNames) { + // load the resource stream + using (var stream = assembly.GetManifestResourceStream(name)) { + // parse the icon data using xml + var doc = XDocument.Load(stream); + + var path = doc.Root.Element("{http://schemas.microsoft.com/winfx/2006/xaml/presentation}Path"); + if (path != null) { + var data = (string)path.Attribute("Data"); + + // create a modern button and add it to the button panel + ButtonPanel.Children.Add(new ModernButton { + IconData = PathGeometry.Parse(data), + Margin = new Thickness(0, 0, 8, 0) + }); + } + } + } + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernDialog.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernDialog.xaml.cs index a60e8abe..04d06a44 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernDialog.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernDialog.xaml.cs @@ -1,56 +1,56 @@ -using FirstFloor.ModernUI.Windows.Controls; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsModernDialog.xaml - /// - public partial class ControlsModernDialog : UserControl - { - public ControlsModernDialog() - { - InitializeComponent(); - } - - private void CommonDialog_Click(object sender, RoutedEventArgs e) - { - var dlg = new ModernDialog { - Title = "Common dialog", - Content = new LoremIpsum() - }; - dlg.Buttons = new Button[] { dlg.OkButton, dlg.CancelButton}; - dlg.ShowDialog(); - - this.dialogResult.Text = dlg.DialogResult.HasValue ? dlg.DialogResult.ToString() : ""; - this.dialogMessageBoxResult.Text = dlg.MessageBoxResult.ToString(); - } - - private void MessageDialog_Click(object sender, RoutedEventArgs e) - { - MessageBoxButton btn = MessageBoxButton.OK; - if (true == ok.IsChecked) btn = MessageBoxButton.OK; - else if (true == okcancel.IsChecked) btn = MessageBoxButton.OKCancel; - else if (true == yesno.IsChecked) btn = MessageBoxButton.YesNo; - else if (true == yesnocancel.IsChecked) btn = MessageBoxButton.YesNoCancel; - - var result = ModernDialog.ShowMessage("This is a simple Modern UI styled message dialog. Do you like it?", "Message Dialog", btn); - - this.msgboxResult.Text = result.ToString(); - } - } -} +using FirstFloor.ModernUI.Windows.Controls; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsModernDialog.xaml + /// + public partial class ControlsModernDialog : UserControl + { + public ControlsModernDialog() + { + InitializeComponent(); + } + + private void CommonDialog_Click(object sender, RoutedEventArgs e) + { + var dlg = new ModernDialog { + Title = "Common dialog", + Content = new LoremIpsum() + }; + dlg.Buttons = new Button[] { dlg.OkButton, dlg.CancelButton}; + dlg.ShowDialog(); + + this.dialogResult.Text = dlg.DialogResult.HasValue ? dlg.DialogResult.ToString() : ""; + this.dialogMessageBoxResult.Text = dlg.MessageBoxResult.ToString(); + } + + private void MessageDialog_Click(object sender, RoutedEventArgs e) + { + MessageBoxButton btn = MessageBoxButton.OK; + if (true == ok.IsChecked) btn = MessageBoxButton.OK; + else if (true == okcancel.IsChecked) btn = MessageBoxButton.OKCancel; + else if (true == yesno.IsChecked) btn = MessageBoxButton.YesNo; + else if (true == yesnocancel.IsChecked) btn = MessageBoxButton.YesNoCancel; + + var result = ModernDialog.ShowMessage("This is a simple Modern UI styled message dialog. Do you like it?", "Message Dialog", btn); + + this.msgboxResult.Text = result.ToString(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernFrame.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernFrame.xaml.cs index a59d4b44..8ab0494f 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernFrame.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernFrame.xaml.cs @@ -1,65 +1,65 @@ -using FirstFloor.ModernUI.Windows.Navigation; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsModernFrame.xaml - /// - public partial class ControlsModernFrame : UserControl - { - private string eventLogMessage; - - public ControlsModernFrame() - { - InitializeComponent(); - - this.TextEvents.Text = eventLogMessage; - } - - private void LogMessage(string message, params object[] o) - { - message = string.Format(CultureInfo.CurrentUICulture, message, o); - - if (this.TextEvents == null) { - this.eventLogMessage += message; - } - else { - this.TextEvents.AppendText(message); - } - } - - private void Frame_FragmentNavigation(object sender, FragmentNavigationEventArgs e) - { - LogMessage("FragmentNavigation: {0}\r\n", e.Fragment); - } - - private void Frame_Navigated(object sender, NavigationEventArgs e) - { - LogMessage("Navigated: [{0}] {1}\r\n", e.NavigationType, e.Source); - } - - private void Frame_Navigating(object sender, NavigatingCancelEventArgs e) - { - LogMessage("Navigating: [{0}] {1}\r\n", e.NavigationType, e.Source); - } - - private void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e) - { - LogMessage("NavigationFailed: {0}\r\n", e.Error.Message); - } - } -} +using FirstFloor.ModernUI.Windows.Navigation; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsModernFrame.xaml + /// + public partial class ControlsModernFrame : UserControl + { + private string eventLogMessage; + + public ControlsModernFrame() + { + InitializeComponent(); + + this.TextEvents.Text = eventLogMessage; + } + + private void LogMessage(string message, params object[] o) + { + message = string.Format(CultureInfo.CurrentUICulture, message, o); + + if (this.TextEvents == null) { + this.eventLogMessage += message; + } + else { + this.TextEvents.AppendText(message); + } + } + + private void Frame_FragmentNavigation(object sender, FragmentNavigationEventArgs e) + { + LogMessage("FragmentNavigation: {0}\r\n", e.Fragment); + } + + private void Frame_Navigated(object sender, NavigationEventArgs e) + { + LogMessage("Navigated: [{0}] {1}\r\n", e.NavigationType, e.Source); + } + + private void Frame_Navigating(object sender, NavigatingCancelEventArgs e) + { + LogMessage("Navigating: [{0}] {1}\r\n", e.NavigationType, e.Source); + } + + private void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e) + { + LogMessage("NavigationFailed: {0}\r\n", e.Error.Message); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernMenu.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernMenu.xaml.cs index 5b170fe2..5cf423cb 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernMenu.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernMenu.xaml.cs @@ -1,65 +1,65 @@ -using FirstFloor.ModernUI.Presentation; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsModernMenu.xaml - /// - public partial class ControlsModernMenu : UserControl - { - private int groupId = 2; - private int linkId = 5; - - public ControlsModernMenu() - { - InitializeComponent(); - - // add group command - this.AddGroup.Command = new RelayCommand(o => { - this.Menu.LinkGroups.Add(new LinkGroup { - DisplayName = string.Format(CultureInfo.InvariantCulture, "group {0}", - ++groupId) - }); - }); - - // add link to selected group command - this.AddLink.Command = new RelayCommand(o => { - this.Menu.SelectedLinkGroup.Links.Add(new Link { - DisplayName = string.Format(CultureInfo.InvariantCulture, "link {0}", ++linkId), - Source = new Uri(string.Format(CultureInfo.InvariantCulture, "/link{0}", linkId), UriKind.Relative) - }); - }, o => this.Menu.SelectedLinkGroup != null); - - // remove selected group command - this.RemoveGroup.Command = new RelayCommand(o => { - this.Menu.LinkGroups.Remove(this.Menu.SelectedLinkGroup); - }, o => this.Menu.SelectedLinkGroup != null); - - // remove selected linkcommand - this.RemoveLink.Command = new RelayCommand(o => { - this.Menu.SelectedLinkGroup.Links.Remove(this.Menu.SelectedLink); - }, o => this.Menu.SelectedLinkGroup != null && this.Menu.SelectedLink != null); - - // log SourceChanged events - this.Menu.SelectedSourceChanged += (o, e) => { - Debug.WriteLine("SelectedSourceChanged: {0}", e.Source); - }; - } - } -} +using FirstFloor.ModernUI.Presentation; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsModernMenu.xaml + /// + public partial class ControlsModernMenu : UserControl + { + private int groupId = 2; + private int linkId = 5; + + public ControlsModernMenu() + { + InitializeComponent(); + + // add group command + this.AddGroup.Command = new RelayCommand(o => { + this.Menu.LinkGroups.Add(new LinkGroup { + DisplayName = string.Format(CultureInfo.InvariantCulture, "group {0}", + ++groupId) + }); + }); + + // add link to selected group command + this.AddLink.Command = new RelayCommand(o => { + this.Menu.SelectedLinkGroup.Links.Add(new Link { + DisplayName = string.Format(CultureInfo.InvariantCulture, "link {0}", ++linkId), + Source = new Uri(string.Format(CultureInfo.InvariantCulture, "/link{0}", linkId), UriKind.Relative) + }); + }, o => this.Menu.SelectedLinkGroup != null); + + // remove selected group command + this.RemoveGroup.Command = new RelayCommand(o => { + this.Menu.LinkGroups.Remove(this.Menu.SelectedLinkGroup); + }, o => this.Menu.SelectedLinkGroup != null); + + // remove selected linkcommand + this.RemoveLink.Command = new RelayCommand(o => { + this.Menu.SelectedLinkGroup.Links.Remove(this.Menu.SelectedLink); + }, o => this.Menu.SelectedLinkGroup != null && this.Menu.SelectedLink != null); + + // log SourceChanged events + this.Menu.SelectedSourceChanged += (o, e) => { + Debug.WriteLine("SelectedSourceChanged: {0}", e.Source); + }; + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernProgressRing.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernProgressRing.xaml.cs index 6579ff72..d4d5a8f8 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernProgressRing.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsModernProgressRing.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsModernProgressRing.xaml - /// - public partial class ControlsModernProgressRing : UserControl - { - public ControlsModernProgressRing() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsModernProgressRing.xaml + /// + public partial class ControlsModernProgressRing : UserControl + { + public ControlsModernProgressRing() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesButton.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesButton.xaml.cs index a371e141..2595cf3c 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesButton.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesButton.xaml.cs @@ -1,33 +1,33 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsStylesButton.xaml - /// - public partial class ControlsStylesButton : UserControl - { - public ControlsStylesButton() - { - InitializeComponent(); - } - - private void CheckBox_Indeterminate(object sender, RoutedEventArgs e) - { - - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsStylesButton.xaml + /// + public partial class ControlsStylesButton : UserControl + { + public ControlsStylesButton() + { + InitializeComponent(); + } + + private void CheckBox_Indeterminate(object sender, RoutedEventArgs e) + { + + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesDataGrid.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesDataGrid.xaml.cs index 7597aa4e..53ad35e5 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesDataGrid.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesDataGrid.xaml.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - // taken from MSDN (http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.aspx) - public enum OrderStatus { None, New, Processing, Shipped, Received }; - public class Customer - { - public string FirstName { get; set; } - public string LastName { get; set; } - public string Email { get; set; } - public bool IsMember { get; set; } - public OrderStatus Status { get; set; } - } - - - /// - /// Interaction logic for ControlsStylesDataGrid.xaml - /// - public partial class ControlsStylesDataGrid : UserControl - { - public ControlsStylesDataGrid() - { - InitializeComponent(); - - ObservableCollection custdata = GetData(); - - //Bind the DataGrid to the customer data - DG1.DataContext = custdata; - } - - private ObservableCollection GetData() - { - var customers = new ObservableCollection(); - customers.Add(new Customer { FirstName = "Orlando", LastName = "Gee", Email = "orlando0@adventure-works.com", IsMember = true, Status = OrderStatus.New }); - customers.Add(new Customer { FirstName = "Keith", LastName = "Harris", Email = "keith0@adventure-works.com", IsMember = true, Status = OrderStatus.Received }); - customers.Add(new Customer { FirstName = "Donna", LastName = "Carreras", Email = "donna0@adventure-works.com", IsMember = false, Status = OrderStatus.None }); - customers.Add(new Customer { FirstName = "Janet", LastName = "Gates", Email = "janet0@adventure-works.com", IsMember = true, Status = OrderStatus.Shipped }); - customers.Add(new Customer { FirstName = "Lucy", LastName = "Harrington", Email = "lucy0@adventure-works.com", IsMember = false, Status = OrderStatus.New }); - customers.Add(new Customer { FirstName = "Rosmarie", LastName = "Carroll", Email = "rosmarie0@adventure-works.com", IsMember = true, Status = OrderStatus.Processing }); - customers.Add(new Customer { FirstName = "Dominic", LastName = "Gash", Email = "dominic0@adventure-works.com", IsMember = true, Status = OrderStatus.Received }); - customers.Add(new Customer { FirstName = "Kathleen", LastName = "Garza", Email = "kathleen0@adventure-works.com", IsMember = false, Status = OrderStatus.None }); - customers.Add(new Customer { FirstName = "Katherine", LastName = "Harding", Email = "katherine0@adventure-works.com", IsMember = true, Status = OrderStatus.Shipped }); - customers.Add(new Customer { FirstName = "Johnny", LastName = "Caprio", Email = "johnny0@adventure-works.com", IsMember = false, Status = OrderStatus.Processing }); - - return customers; - } - } -} +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + // taken from MSDN (http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.aspx) + public enum OrderStatus { None, New, Processing, Shipped, Received }; + public class Customer + { + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public bool IsMember { get; set; } + public OrderStatus Status { get; set; } + } + + + /// + /// Interaction logic for ControlsStylesDataGrid.xaml + /// + public partial class ControlsStylesDataGrid : UserControl + { + public ControlsStylesDataGrid() + { + InitializeComponent(); + + ObservableCollection custdata = GetData(); + + //Bind the DataGrid to the customer data + DG1.DataContext = custdata; + } + + private ObservableCollection GetData() + { + var customers = new ObservableCollection(); + customers.Add(new Customer { FirstName = "Orlando", LastName = "Gee", Email = "orlando0@adventure-works.com", IsMember = true, Status = OrderStatus.New }); + customers.Add(new Customer { FirstName = "Keith", LastName = "Harris", Email = "keith0@adventure-works.com", IsMember = true, Status = OrderStatus.Received }); + customers.Add(new Customer { FirstName = "Donna", LastName = "Carreras", Email = "donna0@adventure-works.com", IsMember = false, Status = OrderStatus.None }); + customers.Add(new Customer { FirstName = "Janet", LastName = "Gates", Email = "janet0@adventure-works.com", IsMember = true, Status = OrderStatus.Shipped }); + customers.Add(new Customer { FirstName = "Lucy", LastName = "Harrington", Email = "lucy0@adventure-works.com", IsMember = false, Status = OrderStatus.New }); + customers.Add(new Customer { FirstName = "Rosmarie", LastName = "Carroll", Email = "rosmarie0@adventure-works.com", IsMember = true, Status = OrderStatus.Processing }); + customers.Add(new Customer { FirstName = "Dominic", LastName = "Gash", Email = "dominic0@adventure-works.com", IsMember = true, Status = OrderStatus.Received }); + customers.Add(new Customer { FirstName = "Kathleen", LastName = "Garza", Email = "kathleen0@adventure-works.com", IsMember = false, Status = OrderStatus.None }); + customers.Add(new Customer { FirstName = "Katherine", LastName = "Harding", Email = "katherine0@adventure-works.com", IsMember = true, Status = OrderStatus.Shipped }); + customers.Add(new Customer { FirstName = "Johnny", LastName = "Caprio", Email = "johnny0@adventure-works.com", IsMember = false, Status = OrderStatus.Processing }); + + return customers; + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesDate.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesDate.xaml.cs index 3a3b4e25..7ff3d00b 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesDate.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesDate.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsStylesDate.xaml - /// - public partial class ControlsStylesDate : UserControl - { - public ControlsStylesDate() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsStylesDate.xaml + /// + public partial class ControlsStylesDate : UserControl + { + public ControlsStylesDate() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesItemsControl.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesItemsControl.xaml.cs index 15000bdd..a5064dd0 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesItemsControl.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesItemsControl.xaml.cs @@ -1,57 +1,57 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsStylesItemsControl.xaml - /// - public partial class ControlsStylesItemsControl : UserControl - { - public ControlsStylesItemsControl() - { - InitializeComponent(); - } - - private MenuItem CreateSubMenu(string header) - { - var item = new MenuItem { Header = header }; - item.Items.Add(new MenuItem { Header = "Item 1" }); - item.Items.Add("Item 2"); - item.Items.Add(new Separator()); - item.Items.Add("Item 3"); - return item; - } - - private void ShowContextMenu_Click(object sender, RoutedEventArgs e) - { - var contextMenu = new ContextMenu(); - - contextMenu.Items.Add(new MenuItem { Header = "Item" }); - contextMenu.Items.Add(new MenuItem { Header = "Item with gesture", InputGestureText="Ctrl+C" }); - contextMenu.Items.Add(new MenuItem { Header = "Item, disabled", IsEnabled = false }); - contextMenu.Items.Add(new MenuItem { Header = "Item, checked", IsChecked = true }); - contextMenu.Items.Add(new MenuItem { Header = "Item, checked and disabled", IsChecked = true, IsEnabled = false }); - contextMenu.Items.Add(new Separator()); - contextMenu.Items.Add(CreateSubMenu("Item with submenu")); - - var menu = CreateSubMenu("Item with submenu, disabled"); - menu.IsEnabled = false; - contextMenu.Items.Add(menu); - - contextMenu.IsOpen = true; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsStylesItemsControl.xaml + /// + public partial class ControlsStylesItemsControl : UserControl + { + public ControlsStylesItemsControl() + { + InitializeComponent(); + } + + private MenuItem CreateSubMenu(string header) + { + var item = new MenuItem { Header = header }; + item.Items.Add(new MenuItem { Header = "Item 1" }); + item.Items.Add("Item 2"); + item.Items.Add(new Separator()); + item.Items.Add("Item 3"); + return item; + } + + private void ShowContextMenu_Click(object sender, RoutedEventArgs e) + { + var contextMenu = new ContextMenu(); + + contextMenu.Items.Add(new MenuItem { Header = "Item" }); + contextMenu.Items.Add(new MenuItem { Header = "Item with gesture", InputGestureText="Ctrl+C" }); + contextMenu.Items.Add(new MenuItem { Header = "Item, disabled", IsEnabled = false }); + contextMenu.Items.Add(new MenuItem { Header = "Item, checked", IsChecked = true }); + contextMenu.Items.Add(new MenuItem { Header = "Item, checked and disabled", IsChecked = true, IsEnabled = false }); + contextMenu.Items.Add(new Separator()); + contextMenu.Items.Add(CreateSubMenu("Item with submenu")); + + var menu = CreateSubMenu("Item with submenu, disabled"); + menu.IsEnabled = false; + contextMenu.Items.Add(menu); + + contextMenu.IsOpen = true; + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesProgressBar.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesProgressBar.xaml.cs index 6bb4066a..3a28947e 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesProgressBar.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesProgressBar.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsStylesProgressBar.xaml - /// - public partial class ControlsStylesProgressBar : UserControl - { - public ControlsStylesProgressBar() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsStylesProgressBar.xaml + /// + public partial class ControlsStylesProgressBar : UserControl + { + public ControlsStylesProgressBar() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesSampleForm.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesSampleForm.xaml.cs index 19e9c8de..dcbcca73 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesSampleForm.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesSampleForm.xaml.cs @@ -1,36 +1,36 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsStylesSampleForm.xaml - /// - public partial class ControlsStylesSampleForm : UserControl - { - public ControlsStylesSampleForm() - { - InitializeComponent(); - - this.Loaded += OnLoaded; - } - - void OnLoaded(object sender, RoutedEventArgs e) - { - // select first control on the form - Keyboard.Focus(this.TextFirstName); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsStylesSampleForm.xaml + /// + public partial class ControlsStylesSampleForm : UserControl + { + public ControlsStylesSampleForm() + { + InitializeComponent(); + + this.Loaded += OnLoaded; + } + + void OnLoaded(object sender, RoutedEventArgs e) + { + // select first control on the form + Keyboard.Focus(this.TextFirstName); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesSlider.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesSlider.xaml.cs index 0d28bcc0..534d7f37 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesSlider.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesSlider.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsStylesSlider.xaml - /// - public partial class ControlsStylesSlider : UserControl - { - public ControlsStylesSlider() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsStylesSlider.xaml + /// + public partial class ControlsStylesSlider : UserControl + { + public ControlsStylesSlider() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesText.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesText.xaml.cs index 4896040b..63446d39 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesText.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ControlsStylesText.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for ControlsStylesText.xaml - /// - public partial class ControlsStylesText : UserControl - { - public ControlsStylesText() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for ControlsStylesText.xaml + /// + public partial class ControlsStylesText : UserControl + { + public ControlsStylesText() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsum.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsum.xaml.cs index 71b2b238..07ddc4ba 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsum.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsum.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for LoremIpsum.xaml - /// - public partial class LoremIpsum : UserControl - { - public LoremIpsum() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for LoremIpsum.xaml + /// + public partial class LoremIpsum : UserControl + { + public LoremIpsum() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsumList.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsumList.xaml.cs index af00d517..4535426c 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsumList.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsumList.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for LoremIpsumList.xaml - /// - public partial class LoremIpsumList : UserControl - { - public LoremIpsumList() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for LoremIpsumList.xaml + /// + public partial class LoremIpsumList : UserControl + { + public LoremIpsumList() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsumSplit.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsumSplit.xaml.cs index 06c74591..27911ff6 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsumSplit.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/LoremIpsumSplit.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for LoremIpsumSplit.xaml - /// - public partial class LoremIpsumSplit : UserControl - { - public LoremIpsumSplit() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for LoremIpsumSplit.xaml + /// + public partial class LoremIpsumSplit : UserControl + { + public LoremIpsumSplit() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/CancelNavigateSample.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/CancelNavigateSample.xaml.cs index a971adc7..233ca192 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/CancelNavigateSample.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/CancelNavigateSample.xaml.cs @@ -1,66 +1,66 @@ -using FirstFloor.ModernUI.Windows; -using FirstFloor.ModernUI.Windows.Controls; -using FirstFloor.ModernUI.Windows.Navigation; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content.ModernFrame -{ - /// - /// Interaction logic for CancelNavigateSample.xaml - /// - public partial class CancelNavigateSample : UserControl, IContent - { - public CancelNavigateSample() - { - InitializeComponent(); - } - - public void OnFragmentNavigation(FragmentNavigationEventArgs e) - { - // display the current navigated fragment - fragmentNav.BBCode = string.Format(CultureInfo.CurrentUICulture, "Current navigation fragment: '[b]{0}[/b]'", e.Fragment); - } - - public void OnNavigatedFrom(NavigationEventArgs e) - { - } - - public void OnNavigatedTo(NavigationEventArgs e) - { - // clear fragment text - fragmentNav.BBCode = null; - } - - public void OnNavigatingFrom(NavigatingCancelEventArgs e) - { - // ask user if navigating away is ok - string frameDescription; - if (e.IsParentFrameNavigating){ - frameDescription = "A parent frame"; - } - else { - frameDescription = "This frame"; - } - - // modern message dialog supports BBCode tags - var question = string.Format(CultureInfo.CurrentUICulture, "[b]{0}[/b] is about to navigate to new content. Do you want to allow this?", frameDescription); - - if (MessageBoxResult.No == ModernDialog.ShowMessage(question, "navigate", System.Windows.MessageBoxButton.YesNo)) { - e.Cancel = true; - } - } - } -} +using FirstFloor.ModernUI.Windows; +using FirstFloor.ModernUI.Windows.Controls; +using FirstFloor.ModernUI.Windows.Navigation; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content.ModernFrame +{ + /// + /// Interaction logic for CancelNavigateSample.xaml + /// + public partial class CancelNavigateSample : UserControl, IContent + { + public CancelNavigateSample() + { + InitializeComponent(); + } + + public void OnFragmentNavigation(FragmentNavigationEventArgs e) + { + // display the current navigated fragment + fragmentNav.BBCode = string.Format(CultureInfo.CurrentUICulture, "Current navigation fragment: '[b]{0}[/b]'", e.Fragment); + } + + public void OnNavigatedFrom(NavigationEventArgs e) + { + } + + public void OnNavigatedTo(NavigationEventArgs e) + { + // clear fragment text + fragmentNav.BBCode = null; + } + + public void OnNavigatingFrom(NavigatingCancelEventArgs e) + { + // ask user if navigating away is ok + string frameDescription; + if (e.IsParentFrameNavigating){ + frameDescription = "A parent frame"; + } + else { + frameDescription = "This frame"; + } + + // modern message dialog supports BBCode tags + var question = string.Format(CultureInfo.CurrentUICulture, "[b]{0}[/b] is about to navigate to new content. Do you want to allow this?", frameDescription); + + if (MessageBoxResult.No == ModernDialog.ShowMessage(question, "navigate", System.Windows.MessageBoxButton.YesNo)) { + e.Cancel = true; + } + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/ErrorSample.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/ErrorSample.xaml.cs index 0c0b64c0..63816742 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/ErrorSample.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/ErrorSample.xaml.cs @@ -1,31 +1,31 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content.ModernFrame -{ - /// - /// Interaction logic for ErrorSample.xaml - /// - public partial class ErrorSample : UserControl - { - public ErrorSample() - { - InitializeComponent(); - - // raise exception to create navigation failure - throw new NotSupportedException(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content.ModernFrame +{ + /// + /// Interaction logic for ErrorSample.xaml + /// + public partial class ErrorSample : UserControl + { + public ErrorSample() + { + InitializeComponent(); + + // raise exception to create navigation failure + throw new NotSupportedException(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/Sample.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/Sample.xaml.cs index a6469208..7332c99e 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/Sample.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/ModernFrame/Sample.xaml.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content.ModernFrame -{ - /// - /// Interaction logic for Sample.xaml - /// - public partial class Sample : UserControl - { - public Sample() - { - InitializeComponent(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content.ModernFrame +{ + /// + /// Interaction logic for Sample.xaml + /// + public partial class Sample : UserControl + { + public Sample() + { + InitializeComponent(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/SettingsAppearance.xaml.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/SettingsAppearance.xaml.cs index 30b6da34..4a3ce754 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/SettingsAppearance.xaml.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/SettingsAppearance.xaml.cs @@ -1,32 +1,32 @@ -using FirstFloor.ModernUI.Presentation; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// Interaction logic for SettingsAppearance.xaml - /// - public partial class SettingsAppearance : UserControl - { - public SettingsAppearance() - { - InitializeComponent(); - - // a simple view model for appearance configuration - this.DataContext = new SettingsAppearanceViewModel(); - } - } -} +using FirstFloor.ModernUI.Presentation; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// Interaction logic for SettingsAppearance.xaml + /// + public partial class SettingsAppearance : UserControl + { + public SettingsAppearance() + { + InitializeComponent(); + + // a simple view model for appearance configuration + this.DataContext = new SettingsAppearanceViewModel(); + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/SettingsAppearanceViewModel.cs b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/SettingsAppearanceViewModel.cs index 2f63efa2..d2e4fd62 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/SettingsAppearanceViewModel.cs +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/Content/SettingsAppearanceViewModel.cs @@ -1,179 +1,179 @@ -using FirstFloor.ModernUI.Presentation; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media; - -namespace FirstFloor.ModernUI.App.Content -{ - /// - /// A simple view model for configuring theme, font and accent colors. - /// - public class SettingsAppearanceViewModel - : NotifyPropertyChanged - { - private const string FontSmall = "small"; - private const string FontLarge = "large"; - - private const string PaletteMetro = "metro"; - private const string PaletteWP = "windows phone"; - - // 9 accent colors from metro design principles - private Color[] metroAccentColors = new Color[]{ - Color.FromRgb(0x33, 0x99, 0xff), // blue - Color.FromRgb(0x00, 0xab, 0xa9), // teal - Color.FromRgb(0x33, 0x99, 0x33), // green - Color.FromRgb(0x8c, 0xbf, 0x26), // lime - Color.FromRgb(0xf0, 0x96, 0x09), // orange - Color.FromRgb(0xff, 0x45, 0x00), // orange red - Color.FromRgb(0xe5, 0x14, 0x00), // red - Color.FromRgb(0xff, 0x00, 0x97), // magenta - Color.FromRgb(0xa2, 0x00, 0xff), // purple - }; - - // 20 accent colors from Windows Phone 8 - private Color[] wpAccentColors = new Color[]{ - Color.FromRgb(0xa4, 0xc4, 0x00), // lime - Color.FromRgb(0x60, 0xa9, 0x17), // green - Color.FromRgb(0x00, 0x8a, 0x00), // emerald - Color.FromRgb(0x00, 0xab, 0xa9), // teal - Color.FromRgb(0x1b, 0xa1, 0xe2), // cyan - Color.FromRgb(0x00, 0x50, 0xef), // cobalt - Color.FromRgb(0x6a, 0x00, 0xff), // indigo - Color.FromRgb(0xaa, 0x00, 0xff), // violet - Color.FromRgb(0xf4, 0x72, 0xd0), // pink - Color.FromRgb(0xd8, 0x00, 0x73), // magenta - Color.FromRgb(0xa2, 0x00, 0x25), // crimson - Color.FromRgb(0xe5, 0x14, 0x00), // red - Color.FromRgb(0xfa, 0x68, 0x00), // orange - Color.FromRgb(0xf0, 0xa3, 0x0a), // amber - Color.FromRgb(0xe3, 0xc8, 0x00), // yellow - Color.FromRgb(0x82, 0x5a, 0x2c), // brown - Color.FromRgb(0x6d, 0x87, 0x64), // olive - Color.FromRgb(0x64, 0x76, 0x87), // steel - Color.FromRgb(0x76, 0x60, 0x8a), // mauve - Color.FromRgb(0x87, 0x79, 0x4e), // taupe - }; - - private string selectedPalette = PaletteWP; - - private Color selectedAccentColor; - private LinkCollection themes = new LinkCollection(); - private Link selectedTheme; - private string selectedFontSize; - - public SettingsAppearanceViewModel() - { - // add the default themes - this.themes.Add(new Link { DisplayName = "dark", Source = AppearanceManager.DarkThemeSource }); - this.themes.Add(new Link { DisplayName = "light", Source = AppearanceManager.LightThemeSource }); - - // add additional themes - this.themes.Add(new Link { DisplayName = "bing image", Source = new Uri("/ModernUIDemo;component/Assets/ModernUI.BingImage.xaml", UriKind.Relative) }); - this.themes.Add(new Link { DisplayName = "hello kitty", Source = new Uri("/ModernUIDemo;component/Assets/ModernUI.HelloKitty.xaml", UriKind.Relative) }); - this.themes.Add(new Link { DisplayName = "love", Source = new Uri("/ModernUIDemo;component/Assets/ModernUI.Love.xaml", UriKind.Relative) }); - this.themes.Add(new Link { DisplayName = "snowflakes", Source = new Uri("/ModernUIDemo;component/Assets/ModernUI.Snowflakes.xaml", UriKind.Relative) }); - - this.SelectedFontSize = AppearanceManager.Current.FontSize == FontSize.Large ? FontLarge : FontSmall; - SyncThemeAndColor(); - - AppearanceManager.Current.PropertyChanged += OnAppearanceManagerPropertyChanged; - } - - private void SyncThemeAndColor() - { - // synchronizes the selected viewmodel theme with the actual theme used by the appearance manager. - this.SelectedTheme = this.themes.FirstOrDefault(l => l.Source.Equals(AppearanceManager.Current.ThemeSource)); - - // and make sure accent color is up-to-date - this.SelectedAccentColor = AppearanceManager.Current.AccentColor; - } - - private void OnAppearanceManagerPropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (e.PropertyName == "ThemeSource" || e.PropertyName == "AccentColor") { - SyncThemeAndColor(); - } - } - - public LinkCollection Themes - { - get { return this.themes; } - } - - public string[] FontSizes - { - get { return new string[] { FontSmall, FontLarge }; } - } - - public string[] Palettes - { - get { return new string[] { PaletteMetro, PaletteWP }; } - } - - public Color[] AccentColors - { - get { return this.selectedPalette == PaletteMetro ? this.metroAccentColors : this.wpAccentColors; } - } - - public string SelectedPalette - { - get { return this.selectedPalette; } - set - { - if (this.selectedPalette != value) { - this.selectedPalette = value; - OnPropertyChanged("AccentColors"); - - this.SelectedAccentColor = this.AccentColors.FirstOrDefault(); - } - } - } - - public Link SelectedTheme - { - get { return this.selectedTheme; } - set - { - if (this.selectedTheme != value) { - this.selectedTheme = value; - OnPropertyChanged("SelectedTheme"); - - // and update the actual theme - AppearanceManager.Current.ThemeSource = value.Source; - } - } - } - - public string SelectedFontSize - { - get { return this.selectedFontSize; } - set - { - if (this.selectedFontSize != value) { - this.selectedFontSize = value; - OnPropertyChanged("SelectedFontSize"); - - AppearanceManager.Current.FontSize = value == FontLarge ? FontSize.Large : FontSize.Small; - } - } - } - - public Color SelectedAccentColor - { - get { return this.selectedAccentColor; } - set - { - if (this.selectedAccentColor != value) { - this.selectedAccentColor = value; - OnPropertyChanged("SelectedAccentColor"); - - AppearanceManager.Current.AccentColor = value; - } - } - } - } -} +using FirstFloor.ModernUI.Presentation; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; + +namespace FirstFloor.ModernUI.App.Content +{ + /// + /// A simple view model for configuring theme, font and accent colors. + /// + public class SettingsAppearanceViewModel + : NotifyPropertyChanged + { + private const string FontSmall = "small"; + private const string FontLarge = "large"; + + private const string PaletteMetro = "metro"; + private const string PaletteWP = "windows phone"; + + // 9 accent colors from metro design principles + private Color[] metroAccentColors = new Color[]{ + Color.FromRgb(0x33, 0x99, 0xff), // blue + Color.FromRgb(0x00, 0xab, 0xa9), // teal + Color.FromRgb(0x33, 0x99, 0x33), // green + Color.FromRgb(0x8c, 0xbf, 0x26), // lime + Color.FromRgb(0xf0, 0x96, 0x09), // orange + Color.FromRgb(0xff, 0x45, 0x00), // orange red + Color.FromRgb(0xe5, 0x14, 0x00), // red + Color.FromRgb(0xff, 0x00, 0x97), // magenta + Color.FromRgb(0xa2, 0x00, 0xff), // purple + }; + + // 20 accent colors from Windows Phone 8 + private Color[] wpAccentColors = new Color[]{ + Color.FromRgb(0xa4, 0xc4, 0x00), // lime + Color.FromRgb(0x60, 0xa9, 0x17), // green + Color.FromRgb(0x00, 0x8a, 0x00), // emerald + Color.FromRgb(0x00, 0xab, 0xa9), // teal + Color.FromRgb(0x1b, 0xa1, 0xe2), // cyan + Color.FromRgb(0x00, 0x50, 0xef), // cobalt + Color.FromRgb(0x6a, 0x00, 0xff), // indigo + Color.FromRgb(0xaa, 0x00, 0xff), // violet + Color.FromRgb(0xf4, 0x72, 0xd0), // pink + Color.FromRgb(0xd8, 0x00, 0x73), // magenta + Color.FromRgb(0xa2, 0x00, 0x25), // crimson + Color.FromRgb(0xe5, 0x14, 0x00), // red + Color.FromRgb(0xfa, 0x68, 0x00), // orange + Color.FromRgb(0xf0, 0xa3, 0x0a), // amber + Color.FromRgb(0xe3, 0xc8, 0x00), // yellow + Color.FromRgb(0x82, 0x5a, 0x2c), // brown + Color.FromRgb(0x6d, 0x87, 0x64), // olive + Color.FromRgb(0x64, 0x76, 0x87), // steel + Color.FromRgb(0x76, 0x60, 0x8a), // mauve + Color.FromRgb(0x87, 0x79, 0x4e), // taupe + }; + + private string selectedPalette = PaletteWP; + + private Color selectedAccentColor; + private LinkCollection themes = new LinkCollection(); + private Link selectedTheme; + private string selectedFontSize; + + public SettingsAppearanceViewModel() + { + // add the default themes + this.themes.Add(new Link { DisplayName = "dark", Source = AppearanceManager.DarkThemeSource }); + this.themes.Add(new Link { DisplayName = "light", Source = AppearanceManager.LightThemeSource }); + + // add additional themes + this.themes.Add(new Link { DisplayName = "bing image", Source = new Uri("/ModernUIDemo;component/Assets/ModernUI.BingImage.xaml", UriKind.Relative) }); + this.themes.Add(new Link { DisplayName = "hello kitty", Source = new Uri("/ModernUIDemo;component/Assets/ModernUI.HelloKitty.xaml", UriKind.Relative) }); + this.themes.Add(new Link { DisplayName = "love", Source = new Uri("/ModernUIDemo;component/Assets/ModernUI.Love.xaml", UriKind.Relative) }); + this.themes.Add(new Link { DisplayName = "snowflakes", Source = new Uri("/ModernUIDemo;component/Assets/ModernUI.Snowflakes.xaml", UriKind.Relative) }); + + this.SelectedFontSize = AppearanceManager.Current.FontSize == FontSize.Large ? FontLarge : FontSmall; + SyncThemeAndColor(); + + AppearanceManager.Current.PropertyChanged += OnAppearanceManagerPropertyChanged; + } + + private void SyncThemeAndColor() + { + // synchronizes the selected viewmodel theme with the actual theme used by the appearance manager. + this.SelectedTheme = this.themes.FirstOrDefault(l => l.Source.Equals(AppearanceManager.Current.ThemeSource)); + + // and make sure accent color is up-to-date + this.SelectedAccentColor = AppearanceManager.Current.AccentColor; + } + + private void OnAppearanceManagerPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == "ThemeSource" || e.PropertyName == "AccentColor") { + SyncThemeAndColor(); + } + } + + public LinkCollection Themes + { + get { return this.themes; } + } + + public string[] FontSizes + { + get { return new string[] { FontSmall, FontLarge }; } + } + + public string[] Palettes + { + get { return new string[] { PaletteMetro, PaletteWP }; } + } + + public Color[] AccentColors + { + get { return this.selectedPalette == PaletteMetro ? this.metroAccentColors : this.wpAccentColors; } + } + + public string SelectedPalette + { + get { return this.selectedPalette; } + set + { + if (this.selectedPalette != value) { + this.selectedPalette = value; + OnPropertyChanged("AccentColors"); + + this.SelectedAccentColor = this.AccentColors.FirstOrDefault(); + } + } + } + + public Link SelectedTheme + { + get { return this.selectedTheme; } + set + { + if (this.selectedTheme != value) { + this.selectedTheme = value; + OnPropertyChanged("SelectedTheme"); + + // and update the actual theme + AppearanceManager.Current.ThemeSource = value.Source; + } + } + } + + public string SelectedFontSize + { + get { return this.selectedFontSize; } + set + { + if (this.selectedFontSize != value) { + this.selectedFontSize = value; + OnPropertyChanged("SelectedFontSize"); + + AppearanceManager.Current.FontSize = value == FontLarge ? FontSize.Large : FontSize.Small; + } + } + } + + public Color SelectedAccentColor + { + get { return this.selectedAccentColor; } + set + { + if (this.selectedAccentColor != value) { + this.selectedAccentColor = value; + OnPropertyChanged("SelectedAccentColor"); + + AppearanceManager.Current.AccentColor = value; + } + } + } + } +} diff --git a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/FirstFloor.ModernUI.App.csproj b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/FirstFloor.ModernUI.App.csproj index 96397fa0..6c46e767 100644 --- a/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/FirstFloor.ModernUI.App.csproj +++ b/1.0/FirstFloor.ModernUI/FirstFloor.ModernUI.App/FirstFloor.ModernUI.App.csproj @@ -1,6 +1,4 @@ - - - + Debug AnyCPU @@ -9,7 +7,8 @@ Properties FirstFloor.ModernUI.App ModernUIDemo - v4.5 + netcoreapp3.1 + true 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 @@ -17,6 +16,10 @@ SAK SAK SAK + false + false + false + false AnyCPU @@ -40,7 +43,7 @@ FirstFloor.ModernUI.App.App - + - - MSBuild:Compile - Designer - - - App.xaml - Code - + ContentLoaderImages.xaml @@ -457,7 +453,11 @@ - + + + MSBuild:Compile + +