Commit 61aa971d authored by shubham's avatar shubham

BUNCH OF PROGRESS. STARTING FIRST MODULE

parent b890f18a
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Input;
using System.Windows.Forms;
using System.Drawing;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
namespace CodedUITestProject
{
/// <summary>
/// Summary description for CodedUITest1
/// </summary>
[CodedUITest]
public class CodedUITest1
{
public CodedUITest1()
{
}
[TestMethod]
public void CodedUITestMethod1()
{
// To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
}
#region Additional test attributes
// You can use the following additional attributes as you write your tests:
////Use TestInitialize to run code before running each test
//[TestInitialize()]
//public void MyTestInitialize()
//{
// // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
//}
////Use TestCleanup to run code after each test has run
//[TestCleanup()]
//public void MyTestCleanup()
//{
// // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
//}
#endregion
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
private TestContext testContextInstance;
public UIMap UIMap
{
get
{
if (this.map == null)
{
this.map = new UIMap();
}
return this.map;
}
}
private UIMap map;
}
}
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{81949951-5980-455C-9329-3F5813D8AAA3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodedUITestProject</RootNamespace>
<AssemblyName>CodedUITestProject</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>CodedUITest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
<Visible>False</Visible>
</CodeAnalysisDependentAssemblyPaths>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UIMap.cs" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' Or '$(VisualStudioVersion)' == '11.0') And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="UIAutomationTypes" />
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CodedUITestProject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CodedUITestProject")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("81949951-5980-455c-9329-3f5813d8aaa3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
namespace CodedUITestProject
{
public partial class UIMap
{
}
}
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DF2F8E59-B31D-4C48-B8E5-54B8CB2EA4FC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodedUITestProject1</RootNamespace>
<AssemblyName>CodedUITestProject1</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>True</IsCodedUITest>
<TestProjectType>CodedUITest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
<Visible>False</Visible>
</CodeAnalysisDependentAssemblyPaths>
</ItemGroup>
<ItemGroup>
<Compile Include="CodedUITest1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UIMap.cs" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' Or '$(VisualStudioVersion)' == '11.0') And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="UIAutomationTypes" />
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CodedUITestProject1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CodedUITestProject1")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("df2f8e59-b31d-4c48-b8e5-54b8cb2ea4fc")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using Personal_Insight.Models;
using Personal_Insight.Pages;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Personal_Insight.ComputeProduct
{
class Android_Device_Configuration_Service
{
private GoogleProductModel googleProduct;
private IntroPage_5 page;
public GoogleProductModel GoogleProduct { get => googleProduct; set => googleProduct = value; }
public List<Devices> devicesList;
public Android_Device_Configuration_Service()
{
}
public void startWork(IntroPage_5 page)
{
this.page = page;
page.enterLog("Starting work on Android_Device_Configuration_Service");
calculate_numFiles();
gatherDevices();
}
private void gatherDevices()
{
devicesList = new List<Devices>();
string[] files = Directory.GetFiles(googleProduct.ProductFolderPath);
foreach(String file in files)
{
page.enterLog(file);
}
}
private void calculate_numFiles()
{
string[] files = Directory.GetFiles(googleProduct.ProductFolderPath);
googleProduct.NumItems = files.Length;
page.enterLog("Num of files: " + googleProduct.NumItems);
}
public class Devices
{
public String Model { get; set; }
public String Brand { get; set; }
public String IMEI { get; set; }
public Devices(string model, string brand, string iMEI)
{
Model = model;
Brand = brand;
IMEI = iMEI;
}
}
}
}
\ No newline at end of file
......@@ -12,17 +12,38 @@ namespace Personal_Insight.Models
private String productName;
private String productFolderPath;
private BitmapImage imageData;
private BitmapImage verifyModuleImage;
private String verifyModuleText;
private Object productObject;
private long dirSize;
private long numItems;
public GoogleProductModel(string productName, string productFolderPath, BitmapImage imageResource)
public GoogleProductModel(string productName, string productFolderPath, BitmapImage imageResource, Object productObject)
{
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"));
verifyModuleText = "Not compatible yet.";
}
else
{
verifyModuleImage = new BitmapImage(new Uri("pack://application:,,,/Personal Insight;component/assets/icons/" + "icons8-tick-box-48.png"));
verifyModuleText = "Imported Sucessfully";
}
}
public string ProductName { get => productName; set => productName = value; }
public string ProductFolderPath { get => productFolderPath; set => productFolderPath = value; }
public BitmapImage ImageResource { get => imageData; set => imageData = value; }
public BitmapImage VerifyModuleImage { get => verifyModuleImage; set => verifyModuleImage = value; }
public String VerifyModuleText { get => verifyModuleText; set => verifyModuleText = value; }
public Object ProductObject { get => productObject; set => productObject = value; }
public long NumItems { get => numItems; set => numItems = value; }
}
}
......@@ -37,7 +37,7 @@ namespace Personal_Insight.Models
}
catch(Exception e)
{
Console.WriteLine("ERROR: {0} Exception caught.", e);
//Console.WriteLine("ERROR: {0} Exception caught.", e);
return 0;
}
}
......
......@@ -56,8 +56,8 @@
<Image x:Name="itemImage" Margin="200,5,20,5" Source="{Binding ImageResource}" Width="32" Height="32"/>
<TextBlock Text="{Binding ProductName}" TextWrapping="Wrap" FontFamily="Microsoft YaHei UI Light" FontSize="16" Foreground="#DDE2E2E2" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" TextAlignment="Left" Width="400" Grid.Column="1" Height="Auto"/>
<TextBlock Text="{Binding ProductFolderPath}" TextWrapping="Wrap" FontFamily="Microsoft YaHei UI Light" FontSize="14" Foreground="#DDA4A4A4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" TextAlignment="Left" Width="500" Grid.Column="2" Height="Auto"/>
<Image Source="/Personal Insight;component/assets/icons/icons8-tick-box-48.png" Width="32" Height="32"/>
<TextBlock Text="Imported Successfully!" TextWrapping="Wrap" FontFamily="Microsoft YaHei UI Light" FontSize="14" Foreground="#DDA4A4A4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,200,0" TextAlignment="Left" Width="Auto" Grid.Column="2" Height="Auto"/>
<Image Source="{Binding VerifyModuleImage}" Width="32" Height="32"/>
<TextBlock Text="{Binding VerifyModuleText}" TextWrapping="Wrap" FontFamily="Microsoft YaHei UI Light" FontSize="14" Foreground="#DDA4A4A4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,200,0" TextAlignment="Left" Width="Auto" Grid.Column="2" Height="Auto"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
......
......@@ -114,7 +114,8 @@ namespace Personal_Insight
googleProductList.Add(new GoogleProductModel(
/*Product name*/ getProductName(dir),
/*Product path*/ dir,
/*Product imgr*/ GoogleProductsList.LoadImage(getProductName(dir))));
/*Product imgr*/ GoogleProductsList.LoadImage(getProductName(dir)),
/*Product obj */ GoogleProductsList.ProductObject ));
}
listView.ItemsSource = googleProductList;
......
......@@ -14,7 +14,8 @@
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
FontFamily="{DynamicResource MaterialDesignFont}"
Loaded="Window_ContentRendered">
Loaded="Window_ContentRendered">
<Page.Background>
<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.75,0">
<GradientStop Color="{DynamicResource Color2}" Offset="0"/>
......@@ -22,25 +23,27 @@
</LinearGradientBrush>
</Page.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Margin="0,50" TextWrapping="Wrap" Text="Processing Google Takeout ..." FontSize="48" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#DDFFFFFF" FontFamily="Microsoft YaHei UI Light" VerticalAlignment="Top"/>
<ProgressBar x:Name="progressBar" Grid.Row="1" IsIndeterminate="True" VerticalAlignment="Center" Margin="25" Height="10" Foreground="#FF066378" Background="#FF878787" BorderBrush="#FF838383"/>
<ProgressBar x:Name="progressBar" Grid.Row="1" VerticalAlignment="Center" Margin="25" Height="10"/>
<TextBox Name="consoleBlock" Text="{Binding Path=ConsoleLogText, Mode=TwoWay}" Grid.Row="2" TextWrapping="Wrap" FontFamily="Microsoft YaHei UI Light" FontSize="20" Foreground="#DDE2E2E2" Background="#FF2E2E2E" Padding="25"/>
<TextBox Grid.Row="2" Text="{Binding Path=ConsoleLogText, Mode=TwoWay}" Background="#FF343434" Foreground="#DDFFFFFF" FontSize="20" ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.CanContentScroll="True" Margin="50" Padding="20" IsReadOnly="True"/>
<Grid Grid.Row="3" Margin="0,50,0,44">
<Grid Grid.Row="5" Margin="0,50,0,44">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
......@@ -53,4 +56,5 @@
</Grid>
</Grid>
</Page>
......@@ -21,36 +21,35 @@ using System.Windows.Threading;
namespace Personal_Insight.Pages
{
/// <summary>
/// Interaction logic for IntroPage_5.xaml
/// </summary>
public partial class IntroPage_5 : Page, INotifyPropertyChanged
{
private int percentageProgress;
private List<GoogleProductModel> googleProductList;
public IntroPage_5(List<GoogleProductModel> googleProductList)
{
DataContext = this;
this.googleProductList = googleProductList;
InitializeComponent();
}
private String _consoleLogText;
public String ConsoleLogText {
public String ConsoleLogText
{
get { return _consoleLogText; }
set
{
if (value != _consoleLogText)
if (_consoleLogText != value)
{
_consoleLogText = value;
OnPropertyChanged("Name2");
OnPropertyChanged();
}
}
}
public IntroPage_5(List<GoogleProductModel> googleProductList)
{
InitializeComponent();
percentageProgress = 0;
this.googleProductList = googleProductList;
}
private void Window_ContentRendered(object sender, EventArgs e)
{
ConsoleLogText = "Starting takeout scan...";
ConsoleLogText = "Starting takeout scan...\n\n";
BackgroundWorker worker = new BackgroundWorker();
worker.WorkerReportsProgress = true;
......@@ -62,42 +61,67 @@ namespace Personal_Insight.Pages
private void worker_DoWork(object sender, DoWorkEventArgs e)
{
/*for (int i = 0; i <= 100; i++)
{
(sender as BackgroundWorker).ReportProgress(i);
Thread.Sleep(100);
}*/
for(int i=0; i< googleProductList.Count; i++)
for (int i = 0; i < googleProductList.Count; i++)
{
product_worker(googleProductList.ElementAt(i));
(sender as BackgroundWorker).ReportProgress((i/googleProductList.Count)*100); // TODO Add a check if count==0
decimal send = ( ((i + 1) / (decimal)googleProductList.Count) * 100);
(sender as BackgroundWorker).ReportProgress((int)send); // TODO Add a check if count==0
}
}
private void product_worker(GoogleProductModel product)
{
Console.WriteLine("The size is {0} bytes.", HelpfulMethods.DirSize(new DirectoryInfo(product.ProductFolderPath)));
enterLog(product.ProductFolderPath);
enterLog("Working on module: " + product.ProductName + " in path, " + product.ProductFolderPath + "\n");
enterLog("The size is " + HelpfulMethods.DirSize(new DirectoryInfo(product.ProductFolderPath)) + "bytes");
//Starting worker
GoogleProductsList.StartWork(product,this);
enterLog("\n");
//DONE Worker
}
private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
//Console.WriteLine("Progress %:" + e.ProgressPercentage);
progressBar.Value = e.ProgressPercentage;
//Once the progress is completed.
if (e.ProgressPercentage >= 100)
{
progressBar.IsIndeterminate = false;
progressBar.Foreground = Brushes.Green;
progressBar.Background = Brushes.Green;
enterLog("Scan complete. Click 'Next' to continue.\n");
}
}
private void enterLog(String log)
/// <summary>
/// Enters, maintains and prints a new log to the Textbox
/// </summary>
/// <param name="log">The log used</param>
public void enterLog(String log)
{
//ConsoleLogText += Environment.NewLine + log;
Console.WriteLine(log);
if (log.Equals("\n"))
{
ConsoleLogText = ConsoleLogText + log + Environment.NewLine;
}
else
{
//ConsoleLogText = "[" + DateTime.Now.ToString("HH:mm:ss tt") + "] " + log + Environment.NewLine + ConsoleLogText;
ConsoleLogText = ConsoleLogText + "[" + DateTime.Now.ToString("HH:mm:ss tt") + "] " + log + Environment.NewLine;
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
......
......@@ -35,6 +35,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">