Commit 8241e300 authored by shubham's avatar shubham

commit all

parent 07a43dbc
......@@ -54,7 +54,7 @@ namespace Personal_Insight.ComputeProduct
int checkedItems = new Regex(Regex.Escape("Checked")).Matches(fileText).Count;
int uncheckedItems = new Regex(Regex.Escape("Unchecked")).Matches(fileText).Count;
shoppingList_list.Add(new ShoppingList(listItems, checkedItems, uncheckedItems));
shoppingList_list.Add(new ShoppingList(listItems, checkedItems, uncheckedItems, Path.GetFileName(file)));
//page.enterLog(listItems + "," + checkedItems + "," + uncheckedItems);
}
......@@ -73,12 +73,14 @@ namespace Personal_Insight.ComputeProduct
public int ListItems { get; set; }
public int CheckedItems { get; set; }
public int UncheckedItems { get; set; }
public String FileName { get; set; }
public ShoppingList(int listItems, int checkedItems, int uncheckedItems)
public ShoppingList(int listItems, int checkedItems, int uncheckedItems, string fileName)
{
ListItems = listItems;
CheckedItems = checkedItems;
UncheckedItems = uncheckedItems;
FileName = fileName;
}
}
......
This diff is collapsed.
......@@ -58,7 +58,7 @@ namespace Personal_Insight.ComputeProduct
name = name.Remove(0, name.IndexOf(">")+ 1);
name = name.Substring(0, name.IndexOf("<"));
bookmarks.Add(new BookMark(name, link));
bookmarks.Add(new BookMark(name, link, ++count));
//page.enterLog("Name: "+ name + ", Link: " + link);
}
}
......@@ -70,15 +70,19 @@ namespace Personal_Insight.ComputeProduct
page.enterLog("Logged " + bookmarks.Count + " Bookmarks!");
}
private int count = 0;
public class BookMark
{
public String name { get; set; }
public String link { get; set; }
public int Count { get; set; }
public BookMark(string name, string link)
public BookMark(string name, string link, int count)
{
this.name = name;
this.link = link;
Count = count;
}
}
}
......
......@@ -53,22 +53,26 @@ namespace Personal_Insight.ComputeProduct
foreach(CalendarEvent calendarEvent in calendar.Events)
{
calendarEvents.Add(new CalendarEvent_(calendarEvent.Summary, calendarEvent.Description, calendarEvent.DtStart.AsSystemLocal.ToString("ddd, dd-MMM-yyy HH:mm:ss")));
calendarEvents.Add(new CalendarEvent_(++count, calendarEvent.Summary, calendarEvent.Description, calendarEvent.DtStart.AsSystemLocal.ToString("ddd, dd-MMM-yyy HH:mm:ss")));
}
}
page.enterLog("Logged " + calendarEvents.Count + " calendar events!");
}
private int count = 0;
public class CalendarEvent_
{
public String eventTitle { get; set; }
public String description { get; set; }
public String eventDate { get; set; }
public int CalendarItem { get; set; }
public CalendarEvent_(String eventTitle, String description, String eventDate)
public CalendarEvent_(int count, String eventTitle, String description, String eventDate)
{
this.CalendarItem = count;
this.eventTitle = eventTitle;
this.description = description;
this.eventDate = eventDate;
......
......@@ -17,17 +17,15 @@ namespace Personal_Insight.Models
private String verifyModuleText;
private Object productObject;
private string isModuleDisabledText;
private double dirSize = 0;
private long numItems = 0;
public GoogleProductModel(string productName, string productFolderPath, BitmapImage imageResource, Object productObject)
public GoogleProductModel(string productName, string productFolderPath, BitmapImage imageResource)
{
this.productName = productName;
this.productFolderPath = productFolderPath;
this.imageData = imageResource;
this.productObject = productObject;
if (imageData.UriSource.ToString().Contains("NotFound"))
{
verifyModuleImage = new BitmapImage(new Uri("pack://application:,,,/Personal Insight;component/assets/icons/" + "icons8-close-window-filled-48.png"));
......@@ -49,12 +47,21 @@ namespace Personal_Insight.Models
public long NumItems { get => numItems; set => numItems = value; }
public double DirSize { get => dirSize; set => dirSize = value; }
public bool isProcessed { get; set; }
public string IsModuleDisabledText {
public bool IsModuleDisabled {
get
{
if (numItems != 0)
return "";
else return "This module is disabled";
return false;
else return true;
}
}
public System.Windows.Media.Color BackgroundColor {
get
{
if (numItems != 0)
return System.Windows.Media.Color.FromArgb(0,0,0,0);
else return System.Windows.Media.Color.FromArgb(100,0,0,0);
}
}
......
using Personal_Insight.ComputeProduct;
using Personal_Insight.Pages;
using Personal_Insight.Pages.ModelPages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
namespace Personal_Insight.Models
{
......@@ -55,7 +57,6 @@ namespace Personal_Insight.Models
public const String Mail = "Mail";
private static Object productObject;
public static Object ProductObject { get => productObject; set => productObject = value; }
// for this code image needs to be a project resource
public static BitmapImage LoadImage(string productName)
......@@ -251,7 +252,6 @@ namespace Personal_Insight.Models
productObject = new Android_Device_Configuration_Service();
((Android_Device_Configuration_Service) productObject ).GoogleProduct = googleProductModel;
((Android_Device_Configuration_Service) productObject).startWork(page);
break;
case ANL:
......@@ -440,6 +440,222 @@ namespace Personal_Insight.Models
productObject = new Android_Device_Configuration_Service();
break;
}
googleProductModel.ProductObject = productObject;
}
public static void NavigateNextPage(GoogleProductModel googleProductModel, Dashboard page)
{
//TODO Maybe check is as an instance of
// rather than strings
string productName = googleProductModel.ProductName;
switch (productName)
{
case ADCS:
{
Page_Android_Device_Configuration_Service nextPage = new Page_Android_Device_Configuration_Service(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case ANL:
{
Page_Assistant_Notes_and_Lists nextPage = new Page_Assistant_Notes_and_Lists(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case Blogger:
{
Page_Blogger nextPage = new Page_Blogger(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case Bookmarks:
{
Page_Bookmarks nextPage = new Page_Bookmarks(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case Calendar:
{
Page_Calendar nextPage = new Page_Calendar(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case Chrome:
{
Page_Chrome nextPage = new Page_Chrome(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case GPC:
{
}
break;
case Contacts:
{
Page_Contacts nextPage = new Page_Contacts(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case CP:
{
Page_Cloud_Print nextPage = new Page_Cloud_Print(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case CS:
{
Page_Classic_Sites nextPage = new Page_Classic_Sites(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case Drive:
{
Page_Drive nextPage = new Page_Drive(googleProductModel);
page.NavigationService.Navigate(nextPage);
}
break;
case Fit:
productObject = new Android_Device_Configuration_Service();
break;
case GC:
productObject = new Android_Device_Configuration_Service();
break;
case GMB:
productObject = new Android_Device_Configuration_Service();
break;
case GPay:
productObject = new Android_Device_Configuration_Service();
break;
case GPB:
productObject = new Android_Device_Configuration_Service();
break;
case GPGS:
productObject = new Android_Device_Configuration_Service();
break;
case GPhotos:
productObject = new Android_Device_Configuration_Service();
break;
case GPlusS:
productObject = new Android_Device_Configuration_Service();
break;
case GPM:
productObject = new Android_Device_Configuration_Service();
break;
case GPMTV:
productObject = new Android_Device_Configuration_Service();
break;
case GPS:
productObject = new Android_Device_Configuration_Service();
break;
case GS:
productObject = new Android_Device_Configuration_Service();
break;
case GSM:
productObject = new Android_Device_Configuration_Service();
break;
case GW:
productObject = new Android_Device_Configuration_Service();
break;
case HA:
productObject = new Android_Device_Configuration_Service();
break;
case Hangouts:
productObject = new Android_Device_Configuration_Service();
break;
case Keep:
productObject = new Android_Device_Configuration_Service();
break;
case LH:
productObject = new Android_Device_Configuration_Service();
break;
case MA:
productObject = new Android_Device_Configuration_Service();
break;
case Mail:
productObject = new Android_Device_Configuration_Service();
break;
case Maps:
productObject = new Android_Device_Configuration_Service();
break;
case MapsYP:
productObject = new Android_Device_Configuration_Service();
break;
case News:
productObject = new Android_Device_Configuration_Service();
break;
case PR:
productObject = new Android_Device_Configuration_Service();
break;
case Profile:
productObject = new Android_Device_Configuration_Service();
break;
case Reminders:
productObject = new Android_Device_Configuration_Service();
break;
case Saved:
productObject = new Android_Device_Configuration_Service();
break;
case SL:
productObject = new Android_Device_Configuration_Service();
break;
case Tasks:
productObject = new Android_Device_Configuration_Service();
break;
case Voice:
productObject = new Android_Device_Configuration_Service();
break;
case YouTube:
productObject = new Android_Device_Configuration_Service();
break;
default:
productObject = new Android_Device_Configuration_Service();
break;
}
}
}
......
......@@ -35,6 +35,8 @@ namespace Personal_Insight.Models.JSON_Models.BrowserHistory
[JsonProperty("url")]
public Uri Url { get; set; }
public String URI_text { get { return Url.ToString(); } }
[JsonProperty("time_usec")]
public long TimeUsec { get; set; }
}
......
<Page x:Class="Personal_Insight.Pages.Dashboard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
......@@ -23,15 +23,19 @@
</LinearGradientBrush>
</Page.Background>
<Page.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Margin="0,50" TextWrapping="Wrap" Text="Personal Insight - Dashboard" FontSize="48" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#DDFFFFFF" FontFamily="Microsoft YaHei UI Light" VerticalAlignment="Top"/>
<ScrollViewer Grid.Row="1" Grid.RowSpan="3" CanContentScroll="True">
<Grid>
<Grid.RowDefinitions>
......@@ -46,7 +50,7 @@
</Grid.ColumnDefinitions>
<Separator Height="2" Background="#3FA0A0A0"/>
<Grid Margin="0" Grid.Row="1" Background="#33000000">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
......@@ -88,29 +92,46 @@
<Separator Height="2" Grid.Row="2" Background="#3FA0A0A0"/>
<TextBlock Margin="0,25,0,0" TextWrapping="Wrap" Text="Choose a module for more information" FontSize="25" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#DDB9B9B9" FontFamily="Microsoft YaHei UI Light" VerticalAlignment="Center" Grid.Row="3"/>
<Grid Grid.Row="4">
<ListView x:Name="listBox" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="25,5" HorizontalAlignment="Center" VerticalAlignment="Center" Background="#00FAFAFA" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListView x:Name="listBox" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="25,5" HorizontalAlignment="Center" VerticalAlignment="Center" Background="#00FAFAFA" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" PreviewMouseLeftButtonUp="listView_Click">
<ListView.ItemTemplate>
<DataTemplate>
<Border BorderThickness="1" CornerRadius="10" ScrollViewer.CanContentScroll="True" HorizontalAlignment="Center" VerticalAlignment="Center">
<Border.Background>
<SolidColorBrush Color="{DynamicResource Color2}" />
</Border.Background>
<Grid Width="300" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" ScrollViewer.CanContentScroll="True" CanVerticallyScroll="True" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<Image Source="{Binding ImageResource}" Width="32" Height="32" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Label Content="{Binding ProductName}" Foreground="White" Width="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" Height="Auto"/>
<Label Content="{Binding IsModuleDisabledText}" Foreground="#FFC74545" Width="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" Height="Auto" FontSize="10" FontWeight="Bold"/>
</StackPanel>
<Grid x:Name="LayoutRoot">
<Grid x:Name="Overlay" Panel.ZIndex="1000">
<Grid.Background>
<SolidColorBrush Color="{Binding BackgroundColor}"/>
</Grid.Background>
<!-- Add controls as needed -->
</Grid>
</Border>
<!-- Use whatever layout you need -->
<ContentControl x:Name="MainContent" />
<Border BorderThickness="1" ScrollViewer.CanContentScroll="True" HorizontalAlignment="Center" VerticalAlignment="Center">
<Border.Background>
<SolidColorBrush Color="{DynamicResource Color2}"/>
</Border.Background>
<Grid Width="300" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" ScrollViewer.CanContentScroll="True" CanVerticallyScroll="True" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<Image Source="{Binding ImageResource}" Width="32" Height="32" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Label Content="{Binding ProductName}" Foreground="White" Width="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" Height="Auto"/>
<Label Content="This module is still being worked on" Visibility="{Binding Path=IsModuleDisabled, Converter={StaticResource BoolToVis}}" Foreground="#FFAC7B7B" Width="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" Height="Auto" FontSize="10" FontWeight="Bold"/>
</StackPanel>
</Grid>
</Border>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemsPanel>
......@@ -122,10 +143,10 @@
</Grid>
</Grid>
</ScrollViewer>
</Grid>
</Page>
......@@ -81,5 +81,14 @@ namespace Personal_Insight.Pages
});
}
private void listView_Click(object sender, RoutedEventArgs e)
{
var item = (sender as ListView).SelectedItem;
if (item != null)
{
GoogleProductsList.NavigateNextPage((GoogleProductModel)item, this);
}
}
}
}
......@@ -119,8 +119,7 @@ namespace Personal_Insight
googleProductList.Add(new GoogleProductModel(
/*Product name*/ getProductName(dir),
/*Product path*/ dir,
/*Product imgr*/ GoogleProductsList.LoadImage(getProductName(dir)),
/*Product obj */ GoogleProductsList.ProductObject ));
/*Product imgr*/ GoogleProductsList.LoadImage(getProductName(dir)) ));
isPopulated = true;
}
......
using Personal_Insight.ComputeProduct;
using Personal_Insight.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading;
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 Personal_Insight.Pages.ModelPages
{
/// <summary>
/// Interaction logic for Page_Android_Device_Configuration_Service.xaml
/// </summary>
public partial class Page_Android_Device_Configuration_Service : Page
{
private GoogleProductModel googleProduct;
private double takeoutSize = 0;
private String takeoutSizeType;
private Android_Device_Configuration_Service productObject;
public Page_Android_Device_Configuration_Service(GoogleProductModel googleProduct)
{
this.googleProduct = googleProduct;
InitializeComponent();
productObject = (Android_Device_Configuration_Service)googleProduct.ProductObject;
dataGrid.ItemsSource = productObject.devicesList;
}
private void Window_ContentRendered(object sender, RoutedEventArgs e)
{
takeoutSize = googleProduct.DirSize;
var tuple = HelpfulMethods.ByteToString(takeoutSize);
takeoutSizeType = tuple.Item2;
takeoutSize = tuple.Item1;
new Thread(CountUpText).Start();
}
public void CountUpText()
{
var watch = System.Diagnostics.Stopwatch.StartNew();
var elapsedMs = watch.ElapsedMilliseconds;
while (elapsedMs < 1000)
{
this.Dispatcher.Invoke(() => {
loggedText.Text = ((int)(googleProduct.NumItems * (elapsedMs / 1000.0))).ToString();
takeoutSizeText.Text = ((int)(takeoutSize * (elapsedMs / 1000.0))) + " " + takeoutSizeType;
});
elapsedMs = watch.ElapsedMilliseconds;
}
watch.Stop();
this.Dispatcher.Invoke(() => {
loggedText.Text = googleProduct.NumItems.ToString();
//string result = String.Format("{0:0.##} {1}", len, sizes[order]);
takeoutSizeText.Text = (String.Format("{0:0.##} ", takeoutSize)) + takeoutSizeType;
});
}
}
}
using Personal_Insight.ComputeProduct;
using Personal_Insight.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
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 Personal_Insight.Pages.ModelPages
{
/// <summary>
/// Interaction logic for Page_Assistant_Notes_and_Lists.xaml
/// </summary>
public partial class Page_Assistant_Notes_and_Lists : Page
{
private GoogleProductModel googleProduct;
private double takeoutSize = 0;
private String takeoutSizeType;
private Assistant_Notes_and_Lists productObject;
public Page_Assistant_Notes_and_Lists(GoogleProductModel googleProduct)
{
this.googleProduct = googleProduct;
InitializeComponent();
productObject = (Assistant_Notes_and_Lists)googleProduct.ProductObject;
dataGrid.ItemsSource = productObject.shoppingList_list;
}
private void Window_ContentRendered(object sender, RoutedEventArgs e)
{
takeoutSize = googleProduct.DirSize;
var tuple = HelpfulMethods.ByteToString(takeoutSize);
takeoutSizeType = tuple.Item2;
takeoutSize = tuple.Item1;