From 6a378d2c3343e5c630904cff75bec41c4c2ae560 Mon Sep 17 00:00:00 2001 From: "AzureAD\\KarthickMani" Date: Tue, 15 Dec 2020 20:06:35 +0530 Subject: [PATCH 1/2] WPF-55869 - Appearance Customization sample updated. --- AppearanceCustomization_2010.csproj | 12 +- Helper/ImageTemplateSelector.cs | 41 +++++ Helper/SubjectImagePaths.xaml | 198 ++++++++++++++++++++++++ Helper/SubjectToImageSourceConverter.cs | 30 ---- Images/Conference_schedule.png | Bin 442 -> 0 bytes Images/Stethoscope.png | Bin 381 -> 0 bytes Images/Troubleshoot.png | Bin 437 -> 0 bytes Images/cake_schedule.png | Bin 300 -> 0 bytes MainWindow.xaml | 92 +++++------ ViewModel/SchedulerViewModel.cs | 28 ++-- 10 files changed, 304 insertions(+), 97 deletions(-) create mode 100644 Helper/ImageTemplateSelector.cs create mode 100644 Helper/SubjectImagePaths.xaml delete mode 100644 Helper/SubjectToImageSourceConverter.cs delete mode 100644 Images/Conference_schedule.png delete mode 100644 Images/Stethoscope.png delete mode 100644 Images/Troubleshoot.png delete mode 100644 Images/cake_schedule.png diff --git a/AppearanceCustomization_2010.csproj b/AppearanceCustomization_2010.csproj index 857a2ac..41e8c40 100644 --- a/AppearanceCustomization_2010.csproj +++ b/AppearanceCustomization_2010.csproj @@ -64,8 +64,12 @@ MSBuild:Compile Designer - + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -106,12 +110,6 @@ - - - - - - diff --git a/Helper/ImageTemplateSelector.cs b/Helper/ImageTemplateSelector.cs new file mode 100644 index 0000000..8f5bf4b --- /dev/null +++ b/Helper/ImageTemplateSelector.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Data; + +namespace AppearanceCustomization +{ + public class ImageTemplateSelector : IValueConverter + { + static ResourceDictionary myResourceDictionary; + /// + /// Initializes a new instance of the class. + /// + static ImageTemplateSelector() + { + myResourceDictionary = new ResourceDictionary(); + myResourceDictionary.Source = + new Uri("/AppointmentCustomization;component/Helper/SubjectImagePaths.xaml", + UriKind.RelativeOrAbsolute); + } + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + string imageName = value.ToString().Replace(" ", "").ToLower(); + DataTemplate dataTemplateImagePaths; + dataTemplateImagePaths = myResourceDictionary[imageName] as DataTemplate; + if (dataTemplateImagePaths != null) + return dataTemplateImagePaths; + else + return myResourceDictionary["default"] as DataTemplate; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + } +} diff --git a/Helper/SubjectImagePaths.xaml b/Helper/SubjectImagePaths.xaml new file mode 100644 index 0000000..085aea6 --- /dev/null +++ b/Helper/SubjectImagePaths.xaml @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Helper/SubjectToImageSourceConverter.cs b/Helper/SubjectToImageSourceConverter.cs deleted file mode 100644 index 9a784c0..0000000 --- a/Helper/SubjectToImageSourceConverter.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Data; - -namespace AppearanceCustomization -{ - public class SubjectToImageSourceConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value.ToString().Equals("Conference")) - return "../Images/Conference_schedule.png"; - else if (value.ToString().Equals("System Troubleshoot")) - return "../Images/Troubleshoot.png"; - else if (value.ToString().Equals("Checkup")) - return "../Images/Stethoscope.png"; - else - return "../Images/cake_schedule.png"; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return null; - } - } -} diff --git a/Images/Conference_schedule.png b/Images/Conference_schedule.png deleted file mode 100644 index a10b6f845f2a419f9be7d783029738c9f63edb62..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 442 zcmV;r0Y(0aP)s604a1yhdWA~iUujJX`E(}5W%p!c1D_Jwfq0q%%55K=crh|>jMGs2*kiQ zFa^@0f}VgakX^_hU|a;ep96fJ6C3cBQkZFGXi6|P0MAqzjbd#`kSP;zr%4c4mQ|a; zI&=wQ3+z;z!1FxQ0ZOz*2_as?FwAPTT4rNY=LUEH%pJ#}(P)q)iH@cz5ZxpYLbQ}U z?*ZEFHlF9P+wC|U4tdWa;O+Dvm!Q|{eFB}+GuL(LcDuN)OTAuC_xt@9umWbl3$QrH zsphDkT=Tx~`-$)SgUx0W8{1R}5#HD(3*bRYspXQ&g{H2r+>fM`Mk~2;p{bpmp&3Xi zS4Adyo&z4MlB{f2MOCSPSHIOCPfICBW$dD8xm>0vgOmcJqTt6KwA44(84icDX0!RM kz~izu>K6Do?(eeW7wG1hR;zGY#Q*>R07*qoM6N<$g0rH)v;Y7A diff --git a/Images/Stethoscope.png b/Images/Stethoscope.png deleted file mode 100644 index b282b09bc0413fabebc926971cef3f0eaadb09db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 381 zcmV-@0fPRCP)jSk=u(vxz`2+aoe2Jr~lAekWDpxvO} zpc%o(>eOryZJ-`X1F|5)a%$iD0bK}+pZpR@_{Rh!Hh9AU*aW6dEN$dd0#)R916r}T zB!M^VfRE@>c)1bF)f+0{4Jb$aYO!_;a9k&rE5MT)j=)Q@2U3!RwymTH z&Vve6rg|Z%TCuz)M}>Ct=jgBMGf!s?&}oyo_zloXI$-}`B~HhQOFi-uBuzMjMyF}E zT+yS7<&-t9A0TPPQcv|kdRa`%)d9_{g)^g)!C3w?ykX}JcW>}|s>SC@Kyq4biF=b= bsiXJ-vQ%b$HcY^K00000NkvXXu0mjfr52>P diff --git a/Images/Troubleshoot.png b/Images/Troubleshoot.png deleted file mode 100644 index 1d01ab34a11d2401d422373d452f60770adf3388..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 437 zcmV;m0ZRUfP)(nLGkF2rCP{0qqIk z1`QHBStEvqg_Xhun$1FD$Up@`LS?ZkK1OnLu?tsMDsug${T!G5`$pL;;5Ko)V?|2k22nF{gxUj@B z7q~!1x(GTRy^kzg4-M^{02NUBR1i7h$BtxXz^|l22~vR^7;`bvzOUD+NFY<-s)1xV zXciHS3gV&j4ixy}YLC z0lG<>!;@Ve^G{x@?v@fKiMXITOqg|y)&;D+-D!WlwT%z8T3b6BTaATbXK6s&K$A}24ArXLFB{~-neV$?B_V=xfk z2Qm$4>3Rj)8LrOopSEE?*eqbgYRLbr_drU3M7uvQGENgDHWdkw;W+`~lj)adq#OV1 zGYLU-k^Mgd8!rQcum%GIzaj&ejSc+$$-wXtm?hrc1Ul*|1EUe9dAQ=>Kf}8lz)-!9 z@C~O3nu|X{T+Jg53>=^%gwz=rS>|Gx$AZ(#LK+YZ^FDeIFtcG=iUqI`6~3S#!WB%^ yE{jGj7_|U*PEJcpqiQicYt}5r;n6q%2rvMm898ET5{ya!0000 - + - - - - + FontStyle="Italic"/> + - - - - - + TextWrapping="Wrap" + FontSize="12" + TextAlignment="Left" + FontStyle="Italic"/> + + - - - - + + @@ -125,7 +127,7 @@ + Margin="0,10,25,0"> diff --git a/ViewModel/SchedulerViewModel.cs b/ViewModel/SchedulerViewModel.cs index da59fe4..d119eee 100644 --- a/ViewModel/SchedulerViewModel.cs +++ b/ViewModel/SchedulerViewModel.cs @@ -67,20 +67,20 @@ private void AddAppointments() var day = random.Next(1, 30); var hour = random.Next(9, 14); var newEvent = new Events(); - newEvent.EventName = this.eventCollection[random.Next(0, 4)]; + newEvent.EventName = this.eventCollection[random.Next(0, 9)]; newEvent.From = new DateTime(year, month, day, hour, 0, 0); newEvent.To = newEvent.From.AddHours(1); - newEvent.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(this.colorCollection[random.Next(0, 15)])); + newEvent.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(this.colorCollection[random.Next(0, 8)])); this.Appointments.Add(newEvent); } for (int i = 0; i < 6; i++) { var allDayEvent = new Events(); - allDayEvent.EventName = this.eventCollection[random.Next(0, 5)]; + allDayEvent.EventName = this.eventCollection[random.Next(0, 9)]; allDayEvent.From = this.startTimeCollection[random.Next(0,10)]; allDayEvent.To = allDayEvent.From.AddHours(1); - allDayEvent.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(this.colorCollection[random.Next(0, 15)])); + allDayEvent.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(this.colorCollection[random.Next(0, 8)])); allDayEvent.IsAllDay = true; this.Appointments.Add(allDayEvent); } @@ -93,10 +93,15 @@ private void InitializingDataForEvents() { this.eventCollection = new List(); this.eventCollection.Add("Conference"); - this.eventCollection.Add("System Troubleshoot"); - this.eventCollection.Add("Birthday"); - this.eventCollection.Add("Checkup"); + this.eventCollection.Add("Business Meeting"); this.eventCollection.Add("Conference"); + this.eventCollection.Add("Medical check up"); + this.eventCollection.Add("Consulting"); + this.eventCollection.Add("Project Status Discussion"); + this.eventCollection.Add("Client Meeting"); + this.eventCollection.Add("General Meeting"); + this.eventCollection.Add("Yoga Therapy"); + this.eventCollection.Add("GoToMeeting"); this.startTimeCollection = new List(); this.startTimeCollection.Add(DateTime.Now.Date.AddHours(10)); @@ -126,15 +131,8 @@ private void InitializingDataForEvents() this.colorCollection.Add("#FFF09609"); this.colorCollection.Add("#FF339933"); this.colorCollection.Add("#FF00ABA9"); - this.colorCollection.Add("#FFE671B8"); - this.colorCollection.Add("#FF1BA1E2"); - this.colorCollection.Add("#FFD80073"); - this.colorCollection.Add("#FFA2C139"); + this.colorCollection.Add("#4F67FF"); this.colorCollection.Add("#FFA2C139"); - this.colorCollection.Add("#FFD80073"); - this.colorCollection.Add("#FF339933"); - this.colorCollection.Add("#FFE671B8"); - this.colorCollection.Add("#FF00ABA9"); } #endregion } From 4caf4befa7873230fe09243070adcbcf6f96f366 Mon Sep 17 00:00:00 2001 From: "AzureAD\\KarthickMani" Date: Wed, 16 Dec 2020 11:14:33 +0530 Subject: [PATCH 2/2] WPF-55869 - Appreaence customization code changes updated. --- MainWindow.xaml | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/MainWindow.xaml b/MainWindow.xaml index 9dca3fc..eb88244 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -31,7 +31,14 @@ VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Orientation="Horizontal"> - + + - @@ -54,7 +54,13 @@ VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Orientation="Horizontal"> - + + - @@ -77,7 +76,14 @@ VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Orientation="Horizontal"> - + + -