コード例 #1
0
		public FrameworkElement View()
		{
			string view = @"
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="" * ""/>
						<ColumnDefinition Width="" 3* ""/>
					</Grid.ColumnDefinitions >
					<Grid.RowDefinitions >
						<RowDefinition Height = ""700""/>
					</Grid.RowDefinitions >
						<local:CalendarHeatMap x:Name = ""Heatmap"" Grid.Column=""0""
							Background=""White""
							ColorAxisTitle = ""User Action Frequency""
							ItemsSource = ""{Binding FilteredShellEvents}""
							SelectionBegin = ""{Binding DateSelectionBegin}""
							SelectionEnd = ""{Binding DateSelectionEnd}""
							SelectionColor=""{ DynamicResource MahApps.Colors.Accent}""
							DateTimeProperty = ""TimeStamp"" Orientation = ""Horizontal"" />
						<local:TimeSeriesHistogram x:Name=""Histogram"" Background=""White"" Grid.Column=""1""
							ColorProperty = ""{Binding ColorProperty, Mode=OneWay}""
							YAxisTitle = ""User Action Frequency""
							MinimumDate = ""{Binding DateSelectionBegin}""
							MaximumDate = ""{Binding DateSelectionEnd}""
							ItemsSource = ""{Binding ShellEvents}"" DateTimeProperty = ""TimeStamp""/>
				</Grid>";


			// add WPF namespaces to a parser context so we can parse WPF tags like StackPanel
			ParserContext context = new ParserContext();
			context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
			context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
			context.XmlnsDictionary.Add("d", "http://schemas.microsoft.com/expression/blend/2008");
			context.XmlnsDictionary.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
			context.XmlnsDictionary.Add("oxy", "http://oxyplot.org/wpf");
			context.XmlnsDictionary.Add("mah", "http://metro.mahapps.com/winfx/xaml/controls");

			CalendarHeatMap heat = new CalendarHeatMap();
			Type type = heat.GetType();
			context.XamlTypeMapper = new XamlTypeMapper(new string[0]);
			context.XamlTypeMapper.AddMappingProcessingInstruction("local", type.Namespace, type.Assembly.FullName);
			context.XmlnsDictionary.Add("local", "local");

			// construct the view using an XAML parser
			FrameworkElement e = XamlReader.Parse(view, context) as FrameworkElement;

			// assign this object as the data context so the view can get/set module properties
			e.DataContext = vm;

			// extract the elements from the view. this is only necessary if we
			// want to use these elements *directly* to do work inside this class.
			var hm = e.FindName("Heatmap") as CalendarHeatMap;
			var th = e.FindName("Histogram") as TimeSeriesHistogram;

			// save elements for later
			TimeHisto = th;
			HeatMap = hm;

			return e;
		}
コード例 #2
0
        public FrameworkElement View()
        {
            string view = @"
			<Grid>
			<local:TimeSeriesHistogram x:Name=""Histogram"" Background=""White"" Height=""500""
										   ColorProperty = ""{Binding ColorProperty, Mode=OneWay}""
										   YAxisTitle = ""User Action Frequency""
										   MinimumDate = ""{Binding DateSelectionBegin}""
										   MaximumDate = ""{Binding DateSelectionEnd}""
										   ItemsSource = ""{Binding ShellEvents}"" DateTimeProperty = ""TimeStamp""/>
			</Grid>"            ;

            ParserContext context = new ParserContext();

            context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
            context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
            context.XmlnsDictionary.Add("d", "http://schemas.microsoft.com/expression/blend/2008");
            context.XmlnsDictionary.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            context.XmlnsDictionary.Add("oxy", "http://oxyplot.org/wpf");
            context.XmlnsDictionary.Add("mah", "http://metro.mahapps.com/winfx/xaml/controls");

            CalendarHeatMap heat = new CalendarHeatMap();
            Type            type = heat.GetType();

            context.XamlTypeMapper = new XamlTypeMapper(new string[0]);
            context.XamlTypeMapper.AddMappingProcessingInstruction("local", type.Namespace, type.Assembly.FullName);
            context.XmlnsDictionary.Add("local", "local");

            FrameworkElement e = XamlReader.Parse(view, context) as FrameworkElement;

            e.DataContext = vm;

            var th = e.FindName("Histogram") as TimeSeriesHistogram;

            TimeHisto = th;

            return(e);
        }
コード例 #3
0
        public FrameworkElement View()
        {
            // the view we will display for the user to configure this object
            string view = @"
			<StackPanel Orientation=""Horizontal"" MinHeight=""800"">
				<local:CalendarHeatMap x:Name=""Heatmap""
					Background=""White""
					ColorAxisTitle =""User Action Frequency""
					ItemsSource =""{Binding FilteredShellEvents}""
					SelectionBegin=""{Binding DateSelectionBegin}""
					SelectionEnd=""{Binding DateSelectionEnd}""
					SelectionColor=""{ DynamicResource MahApps.Colors.Accent}""
					DateTimeProperty=""TimeStamp"" Orientation=""Vertical"" />
				<StackPanel>
				<ToolBar>
					<Button Command=""ApplicationCommands.Cut"" ToolTip=""Cut"" FontFamily=""Segoe MDL2 Assets"" Content=""&#xE8C6;""/>
					<Button Command=""ApplicationCommands.Copy"" ToolTip= ""Copy"" FontFamily=""Segoe MDL2 Assets"" Content=""&#xE8C8;""/>
					<Button Command=""ApplicationCommands.Paste"" ToolTip= ""Paste"" FontFamily=""Segoe MDL2 Assets"" Content=""&#xE77F;""/>	   
				</ToolBar>
				<TextBox Name=""TextBox"" 
					TextAlignment=""Left""
					TextWrapping=""Wrap"" 
					BorderBrush=""Transparent"" CaretBrush=""Black"" 
					Foreground=""Black"" Background=""White"" 
					AcceptsTab=""True"" AcceptsReturn=""True""
					Height=""575"" Width=""450"" 
					MaxHeight=""575"" MaxLength=""2692""/>
				</StackPanel>
			</StackPanel>"            ;


            // add WPF namespaces to a parser context so we can parse WPF tags like StackPanel
            ParserContext context = new ParserContext();

            context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
            context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
            context.XmlnsDictionary.Add("d", "http://schemas.microsoft.com/expression/blend/2008");
            context.XmlnsDictionary.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            context.XmlnsDictionary.Add("oxy", "http://oxyplot.org/wpf");
            context.XmlnsDictionary.Add("mah", "http://metro.mahapps.com/winfx/xaml/controls");

            CalendarHeatMap heat = new CalendarHeatMap();
            Type            type = heat.GetType();

            context.XamlTypeMapper = new XamlTypeMapper(new string[0]);
            context.XamlTypeMapper.AddMappingProcessingInstruction("local", type.Namespace, type.Assembly.FullName);
            context.XmlnsDictionary.Add("local", "local");

            // construct the view using an XAML parser
            FrameworkElement e = XamlReader.Parse(view, context) as FrameworkElement;

            // assign this object as the data context so the view can get/set module properties
            e.DataContext = this;

            // extract the elements from the view. this is only necessary if we
            // want to use these elements *directly* to do work inside this class.
            var hm = e.FindName("Heatmap") as CalendarHeatMap;
            var tb = e.FindName("TextBox") as TextBox;

            // hook up event listeners

            // save RTB element for later
            HeatMap = hm;
            TextBox = tb;

            return(e);
        }
コード例 #4
0
        public FrameworkElement View()
        {
            string view = @"
			<Grid>
				<Grid.ColumnDefinitions>
						<ColumnDefinition Width="" * ""/>
						<ColumnDefinition Width="" * ""/>
					</Grid.ColumnDefinitions >
					<Grid.RowDefinitions >
						<RowDefinition Height = ""800""/>
					</Grid.RowDefinitions >
				<local:TimeSeriesHistogram x:Name=""Histogram"" Background=""White"" Height=""500"" Grid.Column=""0""
					ColorProperty = ""{Binding ColorProperty, Mode=OneWay}""
					YAxisTitle = ""User Action Frequency""
					MinimumDate = ""{Binding DateSelectionBegin}""
					MaximumDate = ""{Binding DateSelectionEnd}""
					ItemsSource = ""{Binding ShellEvents}"" DateTimeProperty = ""TimeStamp""/>
				<StackPanel Grid.Column=""1"">
				<ToolBar>
					<Button Command=""ApplicationCommands.Cut"" ToolTip=""Cut"" FontFamily=""Segoe MDL2 Assets"" Content=""&#xE8C6;""/>
					<Button Command=""ApplicationCommands.Copy"" ToolTip= ""Copy"" FontFamily=""Segoe MDL2 Assets"" Content=""&#xE8C8;""/>
					<Button Command=""ApplicationCommands.Paste"" ToolTip= ""Paste"" FontFamily=""Segoe MDL2 Assets"" Content=""&#xE77F;""/>	   
				</ToolBar>
				<TextBox Name=""TextBox""
					TextAlignment=""Left""
					TextWrapping=""Wrap"" 
					BorderBrush=""Transparent"" CaretBrush=""Black"" 
					Foreground=""Black"" Background=""White"" 
					AcceptsTab=""True"" AcceptsReturn=""True""
					Height=""700"" Width=""300"" 
					MaxHeight=""700"" MaxLength=""2216""/>
				</StackPanel>
			</Grid>"            ;

            ParserContext context = new ParserContext();

            context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
            context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
            context.XmlnsDictionary.Add("d", "http://schemas.microsoft.com/expression/blend/2008");
            context.XmlnsDictionary.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            context.XmlnsDictionary.Add("oxy", "http://oxyplot.org/wpf");
            context.XmlnsDictionary.Add("mah", "http://metro.mahapps.com/winfx/xaml/controls");

            CalendarHeatMap heat = new CalendarHeatMap();
            Type            type = heat.GetType();

            context.XamlTypeMapper = new XamlTypeMapper(new string[0]);
            context.XamlTypeMapper.AddMappingProcessingInstruction("local", type.Namespace, type.Assembly.FullName);
            context.XmlnsDictionary.Add("local", "local");

            // construct the view using an XAML parser
            FrameworkElement e = XamlReader.Parse(view, context) as FrameworkElement;

            e.DataContext = vm;

            var th = e.FindName("Histogram") as TimeSeriesHistogram;
            var tb = e.FindName("TextBox") as TextBox;

            TimeHisto = th;
            TextBox   = tb;

            return(e);
        }
コード例 #5
0
        public FrameworkElement View()
        {
            string view = @"
				<Grid Background=""White"">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width=""335""/>
						<ColumnDefinition Width="" * ""/>
						<ColumnDefinition Width="" * ""/>
						<ColumnDefinition Width="" * ""/>
					</Grid.ColumnDefinitions >
					<Grid.RowDefinitions >
						<RowDefinition Height = ""300""/>
					</Grid.RowDefinitions >
						<oxy:PlotView Grid.Column=""0"" Name=""PieSeries"" Height=""300"" Width=""335"" Model=""{Binding PieModel}""/>
						<StackPanel Name=""ShellbagCount"" Grid.Column=""1""  HorizontalAlignment=""Center"" VerticalAlignment=""Center"">
							<TextBlock Text=""Number"" HorizontalAlignment=""Center"" VerticalAlignment=""Center""
											FontSize=""18"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
							<TextBlock Text=""of"" HorizontalAlignment=""Center"" VerticalAlignment=""Center""
											FontSize=""18"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
							<TextBlock Text=""Shellbags"" HorizontalAlignment=""Center"" VerticalAlignment=""Center""
											FontSize=""18"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
							<TextBlock HorizontalAlignment=""Center"" VerticalAlignment=""Center""/>
							<TextBlock Text=""{Binding ShellbagsCount}"" HorizontalAlignment=""Center"" VerticalAlignment=""Center""
											FontSize=""16"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
						</StackPanel>
						<StackPanel Name=""ShellEventCount"" Grid.Column=""2""  HorizontalAlignment=""Center"" VerticalAlignment=""Center"">
							<TextBlock Text=""Number"" HorizontalAlignment=""Center"" VerticalAlignment=""Center""
											FontSize=""18"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
							<TextBlock Text=""of"" HorizontalAlignment=""Center"" VerticalAlignment=""Center""
											FontSize=""18"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
							<TextBlock Text=""ShellEvents"" HorizontalAlignment=""Center"" VerticalAlignment=""Center""
											FontSize=""18"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
							<TextBlock HorizontalAlignment=""Center"" VerticalAlignment=""Center""/>
							<TextBlock Text=""{Binding EventsCount}"" HorizontalAlignment=""Center"" VerticalAlignment=""Center"" 
											FontSize=""16"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
						</StackPanel>
						<StackPanel Name=""EventSpan"" Grid.Column=""3""  HorizontalAlignment=""Center"" VerticalAlignment=""Center"">
							<TextBlock Text=""Event Span"" HorizontalAlignment=""Center"" VerticalAlignment=""Center"" 
											FontSize=""18"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
							<TextBlock  HorizontalAlignment=""Center"" VerticalAlignment=""Center""/>
							<TextBlock Text=""{Binding BeginDate}"" HorizontalAlignment=""Center"" VerticalAlignment=""Center"" 
											FontSize=""16"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
							<TextBlock Text=""-"" HorizontalAlignment=""Center"" VerticalAlignment=""Center""
											FontSize=""16"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
							<TextBlock Text=""{Binding EndDate}"" HorizontalAlignment=""Center"" VerticalAlignment=""Center"" 
											FontSize=""16"" FontFamily=""Segoe UI"" FontWeight=""Bold""/>
						</StackPanel>
				</Grid>"                ;


            // add WPF namespaces to a parser context so we can parse WPF tags like StackPanel
            ParserContext context = new ParserContext();

            context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
            context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
            context.XmlnsDictionary.Add("d", "http://schemas.microsoft.com/expression/blend/2008");
            context.XmlnsDictionary.Add("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            context.XmlnsDictionary.Add("oxy", "http://oxyplot.org/wpf");
            context.XmlnsDictionary.Add("mah", "http://metro.mahapps.com/winfx/xaml/controls");

            CalendarHeatMap heat = new CalendarHeatMap();
            Type            type = heat.GetType();

            context.XamlTypeMapper = new XamlTypeMapper(new string[0]);
            context.XamlTypeMapper.AddMappingProcessingInstruction("local", type.Namespace, type.Assembly.FullName);
            context.XmlnsDictionary.Add("local", "local");

            // construct the view using an XAML parser
            FrameworkElement e = XamlReader.Parse(view, context) as FrameworkElement;

            e.DataContext = this;

            var ps  = e.FindName("PieSeries") as PlotView;
            var sbc = e.FindName("ShellbagCount") as FrameworkElement;
            var sec = e.FindName("ShellEventCount") as FrameworkElement;
            var es  = e.FindName("EventSpan") as FrameworkElement;

            PiePlot = ps;
            SBCount = sbc;
            SECount = sec;
            ESpan   = es;

            return(e);
        }