Skip to content

Commit

Permalink
Seperated main page and file lister page
Browse files Browse the repository at this point in the history
  • Loading branch information
bharatvaj committed Jun 20, 2020
1 parent 24ffa5c commit 2f7d3ea
Show file tree
Hide file tree
Showing 29 changed files with 4,753 additions and 6 deletions.
77 changes: 77 additions & 0 deletions Addresser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace FileEx
{
public class Addresser:StackPanel
{
public bool root = true;
public void InitializeComponent()
{
HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
Orientation = Windows.UI.Xaml.Controls.Orientation.Horizontal;
//StackPanel stk = new StackPanel();
//stk.Orientation = Windows.UI.Xaml.Controls.Orientation.Horizontal;
//TextBlock content = new TextBlock();
//TextBlock txt = new TextBlock();
//stk.Children.Add(content);
//stk.Children.Add(txt);
//prev.Content = stk;

}

public bool Root
{
get { return root; }
set { root = value; }
}

public void Address(string value, string path)
{
Button current = new Button();
current.BorderThickness = new Thickness(0);
StackPanel currentStk = new StackPanel();
currentStk.Orientation = Windows.UI.Xaml.Controls.Orientation.Horizontal;
TextBlock content = new TextBlock();
TextBlock txtH = new TextBlock();
current.Content = currentStk;
txtH.FontFamily = new FontFamily("Assets/Font/iconFont.ttf#iconfont");
txtH.Text = ".";
txtH.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
txtH.FontSize = 10;
txtH.Foreground = (SolidColorBrush)Application.Current.Resources["SystemAccentColor"];
//content.FontFamily = new FontFamily("Assets/Font/Custom/Raleway-Light.ttf#Raleway");
content.TextLineBounds = TextLineBounds.Tight;
content.TextAlignment = TextAlignment.Center;
content.Text = value;
currentStk.Children.Add(content);
currentStk.Children.Add(txtH);
current.Background = null;
current.Height = this.ActualHeight;
current.MinWidth = 0;
current.Tag = path;
Children.Add(current);
root = false;
}
public void Reset()
{
Children.Clear();
}
public void RemoveLast()
{
Children.RemoveAt(Children.Count - 1);
if (Children.Count == 0) root = true;
else root = false;
}
public void SelectedFolder(int foldersNo)
{
for (int i = Children.Count-1; i < (Children.Count-foldersNo-1); i--)
{
Children.RemoveAt(i);
}
}

}
}
6 changes: 5 additions & 1 deletion App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FileEx">

<Application.Resources>
<Style x:Name="GroupHeaderTextBlockStyle" TargetType="TextBlock">
</Style>
<Style x:Name="ToggleButtonStyle" TargetType="ToggleButton"></Style>
</Application.Resources>
</Application>
Binary file added Assets/ARAM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Font/iconfont.ttf
Binary file not shown.
39 changes: 39 additions & 0 deletions BoolToVisibilityConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace FileEx
{
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;

/// <summary>
/// Converts a Boolean into a Visibility.
/// </summary>
public class BoolToVisibilityConverter : IValueConverter
{
/// <summary>
/// If set to True, conversion is reversed: True will become Collapsed.
/// </summary>
public bool IsReversed { get; set; }

public object Convert(object value, Type targetType, object parameter, string language)
{
var val = System.Convert.ToBoolean(value);
if (this.IsReversed)
{
val = !val;
}

if (val)
{
return Visibility.Visible;
}

return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}

}
}
17 changes: 17 additions & 0 deletions BottomBarItem.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Button
x:Class="FileEx.BottomBarItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FileEx"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
HorizontalAlignment="Right"
BorderBrush="{x:Null}"
BorderThickness="1" FontWeight="Thin"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel MinWidth="35" Grid.Column="1">
<TextBlock x:Name="imageText" FontSize="20" Text="c" FontFamily="Assets/Font/iconFont.ttf#iconfont" HorizontalAlignment="Center" VerticalAlignment="Bottom" />
<TextBlock x:Name="contentText" Text="copy" Grid.Row="1" FontFamily="Assets/Font/Custom/Raleway-Light.ttf#Raleway" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="12" FontWeight="Normal" />
</StackPanel>
</Button>
79 changes: 79 additions & 0 deletions BottomBarItem.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace FileEx
{
public sealed partial class BottomBarItem : Button
{
public BottomBarItem()
{
this.InitializeComponent();
MinWidth = 5;
MinHeight = 5;
Loaded += BottomBarItem_Loaded;
}

public void Initialize()
{
if (IsVertical())
{
contentText.FontSize = Window.Current.Bounds.Width / 35;
imageText.FontSize = Window.Current.Bounds.Width / 20;
}
else
{
contentText.FontSize = Window.Current.Bounds.Height / 35; imageText.FontSize = Window.Current.Bounds.Height / 20;
}
}

public string ImageText
{
get { return imageText.Text; }
set { imageText.Text = value; }
}
public Brush ImageColor
{
get { return imageText.Foreground; }
set { imageText.Foreground = value; }
}
public Brush ContentColor
{
get { return contentText.Foreground; }
set { contentText.Foreground = value; }
}
public string ContentText
{
get { return contentText.Text; }
set { contentText.Text = value; }
}
void BottomBarItem_Loaded(object sender, RoutedEventArgs e)
{
Initialize();
Window.Current.SizeChanged += Current_SizeChanged;
}

void Current_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
//Initialize();
}
public bool IsVertical()
{
if (Window.Current.Bounds.Height > Window.Current.Bounds.Width) return true;
else return false;
}
}
}
37 changes: 37 additions & 0 deletions ColorSampler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Windows.Graphics.Imaging;
using Windows.UI;
using Windows.UI.Xaml.Media.Imaging;

namespace File360
{
class ColorSampler
{
public Color GetPixel(WriteableBitmap wb)
{
int pixel; //ARGB variable with 32 int bytes where
//sets of 8 bytes are: Alpha, Red, Green, Blue
byte r = 0;
byte g = 0;
byte b = 0;
int i = 0;
int j = 0;
//Skip every alternate pixel making the program 4 times faster
for (i = 0; i < wb.PixelWidth; i = i + 2)
{
for (j = 0; j < wb.PixelHeight; j = j + 2)
{
/// TODO add this stupid extension
//pixel = WriteableBitmapExtensions.GetPixeli(wb,i,j); //the ARGB integer(pixel) has the colors of pixel (i,j)
//r = (byte)(r + (255 & (pixel >> 16))); //add up reds
//g = (byte)(g + (255 & (pixel >> 8))); //add up greens
//b = (byte)(b + (255 & (pixel))); //add up blues
}
}
r = (byte)(r / (wb.PixelWidth/2 * wb.PixelHeight/2));
g = (byte)(g / (wb.PixelWidth / 2 * wb.PixelHeight / 2));
b = (byte)(b / (wb.PixelWidth / 2 * wb.PixelHeight / 2));
return Color.FromArgb(100, r, g, b);
}
}

}
72 changes: 72 additions & 0 deletions Dialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;

namespace File360
{
public class Dialog : Grid
{
Storyboard OpenDialog = new Storyboard();
Storyboard CloseDialog = new Storyboard();
public Dialog()
{
Height = Window.Current.Bounds.Height;
Width = Window.Current.Bounds.Width;
Window.Current.SizeChanged += CurrentSizeChanged;
Background = new SolidColorBrush((Color)Application.Current.Resources["ContentDialogDimmingColor"]);
FadeInThemeAnimation fadeInAnimation = new FadeInThemeAnimation();

Storyboard.SetTarget(fadeInAnimation, this);
OpenDialog.Children.Add(fadeInAnimation);


FadeOutThemeAnimation fadeOutAnimation = new FadeOutThemeAnimation();

Storyboard.SetTarget(fadeOutAnimation, this);
CloseDialog.Children.Add(fadeOutAnimation);

}

public bool IsOpen
{
get
{
if (Visibility == Visibility.Collapsed)
return false;
else return true;
}
set
{
if (value == true)
{
Visibility = Visibility.Visible;
OpenDialog.Begin();
}
else
{

CloseDialog.Begin();
CloseDialog.Completed += (s, f) =>
{
Visibility = Visibility.Collapsed;
};
}
}
}

private void CurrentSizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
Height = Window.Current.Bounds.Height;
Width = Window.Current.Bounds.Width;
this.UpdateLayout();
}
}
}
Loading

0 comments on commit 2f7d3ea

Please sign in to comment.