|
18 | 18 | using Windows.Storage.Search;
|
19 | 19 | using Windows.UI.Core;
|
20 | 20 | using Windows.UI.Popups;
|
| 21 | +using Windows.UI.Text; |
21 | 22 | using Windows.UI.Xaml;
|
22 | 23 | using Windows.UI.Xaml.Controls;
|
23 | 24 | using Windows.UI.Xaml.Media.Animation;
|
@@ -84,6 +85,78 @@ public ItemViewModel()
|
84 | 85 | tabInstance.ShareItems.PropertyChanged += ShareItems_PropertyChanged;
|
85 | 86 | tabInstance.LayoutItems.PropertyChanged += LayoutItems_PropertyChanged;
|
86 | 87 | tabInstance.AlwaysPresentCommands.PropertyChanged += AlwaysPresentCommands_PropertyChanged;
|
| 88 | + |
| 89 | + Universal.PropertyChanged += Universal_PropertyChanged; |
| 90 | + } |
| 91 | + |
| 92 | + /* |
| 93 | + * Ensure that the path bar gets updated for user interaction |
| 94 | + * whenever the path changes. We will get the individual directories from |
| 95 | + * the updated, most-current path and add them to the UI. |
| 96 | + */ |
| 97 | + |
| 98 | + private void Universal_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
| 99 | + { |
| 100 | + // Clear the path UI |
| 101 | + GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Clear(); |
| 102 | + Style tabStyleFixed = GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Resources["PathSectionTabStyle"] as Style; |
| 103 | + FontWeight weight = new FontWeight() |
| 104 | + { |
| 105 | + Weight = FontWeights.SemiBold.Weight |
| 106 | + }; |
| 107 | + List<string> pathComponents = new List<string>(); |
| 108 | + if (e.PropertyName == "path") |
| 109 | + { |
| 110 | + // If path is a library, simplify it |
| 111 | + |
| 112 | + // If path is found to not be a library |
| 113 | + pathComponents = Universal.path.Split("\\", StringSplitOptions.RemoveEmptyEntries).ToList(); |
| 114 | + int index = 0; |
| 115 | + foreach(string s in pathComponents) |
| 116 | + { |
| 117 | + string componentLabel = null; |
| 118 | + string tag = ""; |
| 119 | + if (s.Contains(":")) |
| 120 | + { |
| 121 | + if (s == @"C:" || s == @"c:") |
| 122 | + { |
| 123 | + componentLabel = @"Local Disk (C:\)"; |
| 124 | + } |
| 125 | + else |
| 126 | + { |
| 127 | + componentLabel = @"Drive (" + s + @"\)"; |
| 128 | + } |
| 129 | + tag = s + @"\"; |
| 130 | + |
| 131 | + GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(new Microsoft.UI.Xaml.Controls.TabViewItem() |
| 132 | + { |
| 133 | + Header = componentLabel + " >", |
| 134 | + Tag = tag, |
| 135 | + CornerRadius = new CornerRadius(0), |
| 136 | + Style = tabStyleFixed, |
| 137 | + FontWeight = weight |
| 138 | + }); |
| 139 | + } |
| 140 | + else |
| 141 | + { |
| 142 | + componentLabel = s; |
| 143 | + foreach (string part in pathComponents.GetRange(0, index + 1)) |
| 144 | + { |
| 145 | + tag = tag + part + @"\"; |
| 146 | + } |
| 147 | + |
| 148 | + GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(new Microsoft.UI.Xaml.Controls.TabViewItem() |
| 149 | + { |
| 150 | + Header = componentLabel + " >", |
| 151 | + Tag = tag, |
| 152 | + CornerRadius = new CornerRadius(0), |
| 153 | + Style = tabStyleFixed, |
| 154 | + FontWeight = weight |
| 155 | + }); |
| 156 | + } |
| 157 | + index++; |
| 158 | + } |
| 159 | + } |
87 | 160 | }
|
88 | 161 |
|
89 | 162 | private void AlwaysPresentCommands_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
|
0 commit comments