Commit 49c89e44 authored by shubham's avatar shubham

Successfully displays the list. Just need to double check the order!

parent 42d3132b
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
namespace Personal_Insight.Models
{
......@@ -10,17 +11,17 @@ namespace Personal_Insight.Models
{
private String productName;
private String productFolderPath;
private String imageResource;
private BitmapImage imageData;
public GoogleProductModel(string productName, string productFolderPath, string imageResource)
public GoogleProductModel(string productName, string productFolderPath, BitmapImage imageResource)
{
this.productName = productName;
this.productFolderPath = productFolderPath;
this.imageResource = imageResource;
this.imageData = imageResource;
}
public string ProductName { get => productName; set => productName = value; }
public string ProductFolderPath { get => productFolderPath; set => productFolderPath = value; }
public string ImageResource { get => imageResource; set => imageResource = value; }
public BitmapImage ImageResource { get => imageData; set => imageData = value; }
}
}
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
namespace Personal_Insight.Models
{
......@@ -51,6 +52,183 @@ namespace Personal_Insight.Models
public const String YouTube = "YouTube";
public const String Mail = "Mail";
// for this code image needs to be a project resource
public static BitmapImage LoadImage(string productName)
{
string fileName;
switch (productName)
{
case ADCS:
fileName = "ADCS";
break;
case ANL:
fileName = "ANL";
break;
case Blogger:
fileName = "Blogger";
break;
case Bookmarks:
fileName = "Bookmarks";
break;
case Calendar:
fileName = "Calendar";
break;
case Chrome:
fileName = "Calendar";
break;
case Contacts:
fileName = "Contacts";
break;
case CP:
fileName = "CP";
break;
case CS:
fileName = "CS";
break;
case Drive:
fileName = "Drive";
break;
case Fit:
fileName = "Fit";
break;
case GC:
fileName = "GC";
break;
case GMB:
fileName = "GMB";
break;
case GPay:
fileName = "GPay";
break;
case GPB:
fileName = "GPB";
break;
case GPGS:
fileName = "GPGS";
break;
case GPhotos:
fileName = "GPhotos";
break;
case GPlusS:
fileName = "GPlusS";
break;
case GPM:
fileName = "GPM";
break;
case GPMTV:
fileName = "GPMTV";
break;
case GPS:
fileName = "GPS";
break;
case GS:
fileName = "GS";
break;
case GSM:
fileName = "GSM";
break;
case GW:
fileName = "GW";
break;
case HA:
fileName = "HA";
break;
case Hangouts:
fileName = "Hangouts";
break;
case Keep:
fileName = "Keep";
break;
case LH:
fileName = "LH";
break;
case MA:
fileName = "MA";
break;
case Mail:
fileName = "Mail";
break;
case Maps:
fileName = "Maps";
break;
case MapsYP:
fileName = "MapsYP";
break;
case News:
fileName = "News";
break;
case PR:
fileName = "PR";
break;
case Profile:
fileName = "Profile";
break;
case Reminders:
fileName = "Reminders";
break;
case Saved:
fileName = "Saved";
break;
case SL:
fileName = "SL";
break;
case Tasks:
fileName = "Tasks";
break;
case Voice:
fileName = "Voice";
break;
case YouTube:
fileName = "YouTube";
break;
default:
fileName = "Google";
break;
}
return new BitmapImage(new Uri("pack://application:,,,/Personal Insight;component/assets/google_products/"+fileName+".png"));
}
}
......
......@@ -47,25 +47,17 @@
<Button Content="Select folder" Height="Auto" Margin="20,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Padding="50,15" Click="btnClick_openFile" Grid.Column="1"/>
</Grid>
<ListView x:Name="listView" Margin="0,100" Background="#FF646464" Padding="50" Grid.Row="2" HorizontalAlignment="Center">
<ListView x:Name="listView" Margin="0,25,0,0" Background="#FF646464" Padding="50" Grid.Row="2" HorizontalAlignment="Center">
<ListView.ItemTemplate>
<DataTemplate>
<Grid ShowGridLines="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0">
<Image x:Name="itemImage" Source="pay_32dp.png" Margin="20,5"/>
<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"/>
<CheckBox Grid.Column="3" Width="Auto" Height="Auto" HorizontalAlignment="Right" IsChecked="True" Background="#FF39D80B" VerticalAlignment="Center" Padding="0" Margin="0,0,200,0"/>
</Grid>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
......
......@@ -77,22 +77,17 @@ namespace Personal_Insight
private void populateArrayList(String folderName)
{
//googleProductList.Add(new GoogleProductModel())
//listView.Items.Clear();
string[] files = Directory.GetFiles(folderName);
string[] dirs = Directory.GetDirectories(folderName);
//listView.Items.Add(string.Join(Environment.NewLine, files));
//listView.Items.Add(string.Join(Environment.NewLine, dirs));
foreach (string dir in dirs)
{
Console.WriteLine("Running loop");
googleProductList.Add(new GoogleProductModel(
/*Product name*/ getProductName(dir),
/*Product path*/ dir,
/*Product imgr*/ dir ));
/*Product imgr*/ GoogleProductsList.LoadImage(getProductName(dir))));
}
listView.ItemsSource = googleProductList;
......
......@@ -147,59 +147,51 @@
<Resource Include="Pages\pay_32dp.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="assets\google_products\pay_32dp.png" />
<Resource Include="googleg_36dp.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="assets\google_products\blogger_32dp.png" />
<Resource Include="assets\google_products\bookmarks_googblue_36dp.png" />
<Resource Include="assets\google_products\bookmarks_ldpi.png" />
<Resource Include="assets\google_products\calendar_32dp.png" />
<Resource Include="assets\google_products\chrome_32dp.png" />
<Resource Include="assets\google_products\classroom_32dp.png" />
<Resource Include="assets\google_products\cloud_print_32dp.png" />
<Resource Include="assets\google_products\contacts_32dp.png" />
<Resource Include="assets\google_products\devices_other_googblue_48dp.png" />
<Resource Include="assets\google_products\drive_32dp.png" />
<Resource Include="assets\google_products\gboard_32dp.png" />
<Resource Include="assets\google_products\gfit_36dp.png" />
<Resource Include="assets\google_products\gmail_32dp.png" />
<Resource Include="assets\google_products\googleg_36dp.png" />
<Resource Include="assets\google_products\google_home_32dp.png" />
<Resource Include="assets\google_products\google_my_business_32dp.png" />
<Resource Include="assets\google_products\google_news_32dp.png" />
<Resource Include="assets\google_products\google_takout-shopping_list_32x32.png" />
<Resource Include="assets\google_products\google_voice_36dp.png" />
<Resource Include="assets\google_products\groups_32dp.png" />
<Resource Include="assets\google_products\hands_free_64.png" />
<Resource Include="assets\google_products\hangouts_32dp.png" />
<Resource Include="assets\google_products\hangouts_on_air_32dp.png" />
<Resource Include="assets\google_products\history_googblue_36dp.png" />
<Resource Include="assets\google_products\ic_tailwind_32dp.png" />
<Resource Include="assets\google_products\identity_32dp.png" />
<Resource Include="assets\google_products\keep_48dp.png" />
<Resource Include="assets\google_products\logo_gsuite_marketplace_48.png" />
<Resource Include="assets\google_products\logo_my_maps_32x32.png" />
<Resource Include="assets\google_products\maps_32dp.png" />
<Resource Include="assets\google_products\maps_48dp.png" />
<Resource Include="assets\google_products\one_32dp.png" />
<Resource Include="assets\google_products\order_purchase_96x96_0f9e2a7d902a3e349c9bc81b74a2ff55.png" />
<Resource Include="assets\google_products\photos_32dp.png" />
<Resource Include="assets\google_products\play_books_32dp.png" />
<Resource Include="assets\google_products\play_devconsole_32dp.png" />
<Resource Include="assets\google_products\play_games_32dp.png" />
<Resource Include="assets\google_products\play_movies_32dp.png" />
<Resource Include="assets\google_products\play_music_32dp.png" />
<Resource Include="assets\google_products\play_prism_32dp.png" />
<Resource Include="assets\google_products\reminder_googblue_36dp.png" />
<Resource Include="assets\google_products\shopping_48dp.png" />
<Resource Include="assets\google_products\sites_32dp.png" />
<Resource Include="assets\google_products\streetview_32dp.png" />
<Resource Include="assets\google_products\tasks_32dp.png" />
<Resource Include="assets\google_products\textcube_64.png" />
<Resource Include="assets\google_products\verified_user_googblue_36dp.png" />
<Resource Include="assets\google_products\warehouse_ldpi.png" />
<Resource Include="assets\google_products\youtube_32dp.png" />
<Resource Include="assets\google_products\youtube_gaming_32.png" />
<Resource Include="assets\google_products\ADCS.png" />
<Resource Include="assets\google_products\ANL.png" />
<Resource Include="assets\google_products\Blogger.png" />
<Resource Include="assets\google_products\Bookmarks.png" />
<Resource Include="assets\google_products\Calendar.png" />
<Resource Include="assets\google_products\Chrome.png" />
<Resource Include="assets\google_products\Contacts.png" />
<Resource Include="assets\google_products\CP.png" />
<Resource Include="assets\google_products\CS.png" />
<Resource Include="assets\google_products\Drive.png" />
<Resource Include="assets\google_products\Fit.png" />
<Resource Include="assets\google_products\GC.png" />
<Resource Include="assets\google_products\GMB.png" />
<Resource Include="assets\google_products\Google.png" />
<Resource Include="assets\google_products\GPay.png" />
<Resource Include="assets\google_products\GPB.png" />
<Resource Include="assets\google_products\GPGS.png" />
<Resource Include="assets\google_products\GPhotos.png" />
<Resource Include="assets\google_products\GPlusS.png" />
<Resource Include="assets\google_products\GPM.png" />
<Resource Include="assets\google_products\GPMTV.png" />
<Resource Include="assets\google_products\GPS.png" />
<Resource Include="assets\google_products\GS.png" />
<Resource Include="assets\google_products\GSM.png" />
<Resource Include="assets\google_products\GW.png" />
<Resource Include="assets\google_products\HA.png" />
<Resource Include="assets\google_products\Hangouts.png" />
<Resource Include="assets\google_products\Keep.png" />
<Resource Include="assets\google_products\LH.png" />
<Resource Include="assets\google_products\MA.png" />
<Resource Include="assets\google_products\Mail.png" />
<Resource Include="assets\google_products\Maps.png" />
<Resource Include="assets\google_products\MapsYP.png" />
<Resource Include="assets\google_products\News.png" />
<Resource Include="assets\google_products\PR.png" />
<Resource Include="assets\google_products\Profile.png" />
<Resource Include="assets\google_products\Reminders.png" />
<Resource Include="assets\google_products\Saved.png" />
<Resource Include="assets\google_products\SL.png" />
<Resource Include="assets\google_products\Tasks.png" />
<Resource Include="assets\google_products\Voice.png" />
<Resource Include="assets\google_products\YouTube.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment