file360

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using WinRTXamlToolkit.Controls;
namespace File360
{
    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["PhoneAccentBrush"];
            //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);
            }
        }
        
    }
}