Skip to content

Commit

Permalink
Merge pull request #56 from Planshit/dev
Browse files Browse the repository at this point in the history
1.3.3
  • Loading branch information
noberumotto authored Oct 7, 2020
2 parents 49419b2 + d5b997e commit 7808b86
Show file tree
Hide file tree
Showing 109 changed files with 1,124 additions and 1,068 deletions.
4 changes: 2 additions & 2 deletions src/Local/Project1.UI/Controls/CompareView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ private void Calculate()
popupText = popupText.Replace("{a}", $"{DataA.ToString()}");
popupText = popupText.Replace("{b}", $"{DataB.ToString()}");

string diffvalueText = DiffValue > 0 ? $"+{DiffValue.ToString()}%" : DiffValue == 0 ? "无变化" : $"{DiffValue.ToString()}%";
string diffvalueText = DiffValue > 0 ? $"+{DiffValue.ToString()}%" : DiffValue == 0 ? $"{Application.Current.Resources["Lang_Nochange"]}" : $"{DiffValue.ToString()}%";
if (DataA == DataB)
{
diffvalueText = "无变化";
diffvalueText = $"{Application.Current.Resources["Lang_Nochange"]}";
}
popupText = popupText.Replace("{diffvalue}", diffvalueText);
PopupTextBlock.Text = popupText;
Expand Down
28 changes: 14 additions & 14 deletions src/Local/Project1.UI/Controls/Project1UIDesignContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,25 @@ private ContextMenu CreateItemContextMenu(Project1UIDesignItem item)
var menu = new ContextMenu();
var itemRemove = new MenuItem();
var controlPoint = item.RenderTransform as TranslateTransform;
itemRemove.Header = "删除此元素";
itemRemove.Header = $"{Application.Current.Resources["Lang_Delete"]}";
itemRemove.Click += (s, e) =>
{
Children.Remove(item);
};
var itemHcenter = new MenuItem();
itemHcenter.Header = "水平居中";
itemHcenter.Header = $"{Application.Current.Resources["Lang_HorizontalCenter"]}";
itemHcenter.Click += (s, e) =>
{
controlPoint.X = this.ActualWidth / 2 - item.ActualWidth / 2;
};
var itemVcenter = new MenuItem();
itemVcenter.Header = "垂直居中";
itemVcenter.Header = $"{Application.Current.Resources["Lang_VerticalCenter"]}";
itemVcenter.Click += (s, e) =>
{
controlPoint.Y = this.ActualHeight / 2 - item.ActualHeight / 2;
};
var itemAtt = new MenuItem();
itemAtt.Header = "属性";
itemAtt.Header = $"{Application.Current.Resources["Lang_Attribute"]}";
itemAtt.Click += (s, e) =>
{
item.OpenAttPopup();
Expand All @@ -145,10 +145,10 @@ private ContextMenu CreateContextMenu()
{
var menu = new ContextMenu();
var itemAdd = new MenuItem();
itemAdd.Header = "添加元素";
itemAdd.Header = $"{Application.Current.Resources["Lang_AddElement"]}";
//图片
var itemAddImage = new MenuItem();
itemAddImage.Header = "图片";
itemAddImage.Header = $"{Application.Current.Resources["Lang_Image"]}";
itemAddImage.Click += (s, e) =>
{
var item = new Project1UIDesignItem();
Expand All @@ -164,12 +164,12 @@ private ContextMenu CreateContextMenu()
};
//按钮
var itemAddButton = new MenuItem();
itemAddButton.Header = "按钮";
itemAddButton.Header = $"{Application.Current.Resources["Lang_Button"]}";
itemAddButton.Click += (s, e) =>
{
var item = new Project1UIDesignItem();
var data = item.DataContext as DesignItemModel;
data.ButtonText = "按钮";
data.ButtonText = $"{Application.Current.Resources["Lang_Button"]}";
data.Width = 100;
data.Height = 25;
var element = new Project1UIButton();
Expand All @@ -180,12 +180,12 @@ private ContextMenu CreateContextMenu()
};
//文本
var itemAddText = new MenuItem();
itemAddText.Header = "文本";
itemAddText.Header = $"{Application.Current.Resources["Lang_Text"]}";
itemAddText.Click += (s, e) =>
{
var item = new Project1UIDesignItem();
var data = item.DataContext as DesignItemModel;
data.Text = "文本";
data.Text = $"{Application.Current.Resources["Lang_Text"]}";
data.Width = 100;
data.Height = 25;
var element = new TextBlock();
Expand All @@ -196,7 +196,7 @@ private ContextMenu CreateContextMenu()
};
//属性编辑
var itemAttr = new MenuItem();
itemAttr.Header = "属性";
itemAttr.Header = $"{Application.Current.Resources["Lang_Attribute"]}";
itemAttr.Click += (s, e) =>
{
isContextMenuOpen = true;
Expand Down Expand Up @@ -248,7 +248,7 @@ private void CreateAttrWindow()
});
grid.Children.Add(new TextBlock()
{
Text = "窗口属性编辑面板",
Text = $"{Application.Current.Resources["Lang_WindowAttribute"]}",
FontWeight = FontWeights.Bold,
VerticalAlignment = VerticalAlignment.Center
});
Expand All @@ -273,7 +273,7 @@ private void CreateAttrWindow()
});
//添加透明度属性
var opacityName = new TextBlock();
opacityName.Text = "透明度";
opacityName.Text = $"{Application.Current.Resources["Lang_Opacity"]}";
opacityName.VerticalAlignment = VerticalAlignment.Center;
var opacityTextBox = new Project1UIInput();
opacityTextBox.Height = 25;
Expand All @@ -294,7 +294,7 @@ private void CreateAttrWindow()
stackPanelGrid.Children.Add(opacityTextBox);
//添加背景颜色属性
var backgroundName = new TextBlock();
backgroundName.Text = "背景颜色";
backgroundName.Text = $"{Application.Current.Resources["Lang_BackgroundColor"]}";
backgroundName.Margin = new Thickness(0, 10, 0, 0);
backgroundName.VerticalAlignment = VerticalAlignment.Center;
backgroundName.SetValue(Grid.RowProperty, 1);
Expand Down
9 changes: 9 additions & 0 deletions src/Local/Project1.UI/Controls/Project1UIKeyboardInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ namespace Project1.UI.Controls
{
public class Project1UIKeyboardInput : Control
{
public string Placeholder
{
get { return (string)GetValue(PlaceholderProperty); }
set { SetValue(PlaceholderProperty, value); }
}

public static readonly DependencyProperty PlaceholderProperty =
DependencyProperty.Register("Placeholder", typeof(string), typeof(Project1UIKeyboardInput), new PropertyMetadata(""));

public string KeyText
{
get { return (string)GetValue(KeyTextProperty); }
Expand Down
15 changes: 13 additions & 2 deletions src/Local/Project1.UI/Cores/Theme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void SetTheme(string name, string path = null)
{
UIDefaultSetting.DefaultThemeName = name;



var configDict = GetResourceDictionary($"{UIDefaultSetting.DefaultThemeFullPath}/Config.xaml");
var controlDict = GetResourceDictionary($"{UIDefaultSetting.DefaultThemeFullPath}/Style.xaml");
Expand All @@ -105,7 +105,18 @@ public void SetTheme(string name, string path = null)
Debug.WriteLine("themeName:" + themename + "/" + name);
if (themename != null && themename.ToString() != name || themename == null)
{
MergedDictionaries.Clear();
//MergedDictionaries.Clear();
//清除旧主题
var mds = System.Windows.Application.Current.Resources.MergedDictionaries;
var oldStyles = mds.Where(m => m.Source.OriginalString.Contains(themename.ToString())).ToList();
if (oldStyles != null)
{
foreach (var oldStyle in oldStyles)
{
mds.Remove(oldStyle);
}
}

MergedDictionaries.Add(configDict);
MergedDictionaries.Add(controlDict);
Debug.WriteLine("已加载主题:" + name);
Expand Down
2 changes: 1 addition & 1 deletion src/Local/Project1.UI/Themes/Chart/Chart.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
</Border.Effect>
<Grid>
<TextBlock>
<Run Text="平均 "/>
<Run Text="{DynamicResource Lang_Average}"/>
<Run Text="{TemplateBinding AverageText}"/>
</TextBlock>
<Path
Expand Down
2 changes: 1 addition & 1 deletion src/Local/Project1.UI/Themes/Chart/ChartItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Color x:Key="hoverForeground">#4f6bed</Color>-->
<Style TargetType="{x:Type controls:ChartItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Width" Value="20" />
<Setter Property="Width" Value="30" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="ItemColor" Value="#4f6bed"/>
<Setter Property="Foreground" Value="#9e9ea7"/>
Expand Down
6 changes: 3 additions & 3 deletions src/Local/Project1.UI/Themes/DatePicker/DatePicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
</Grid.ColumnDefinitions>
<Grid>
<StackPanel>
<TextBlock Text="年份" FontWeight="Bold" FontSize="14"/>
<TextBlock Text="{DynamicResource Lang_Year}" FontWeight="Bold" FontSize="14"/>
<controls:ItemList x:Name="YearsList" Margin="0,5,0,0"/>
</StackPanel>

</Grid>
<Grid Grid.Column="1">
<StackPanel>
<TextBlock Text="月份" FontWeight="Bold" FontSize="14"/>
<TextBlock Text="{DynamicResource Lang_Monthly}" FontWeight="Bold" FontSize="14"/>
<controls:ItemList x:Name="MonthsList" Margin="0,5,0,0"/>
</StackPanel>

Expand Down Expand Up @@ -77,7 +77,7 @@
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontFamily="/Project1.UI;component/Assets/IconFonts/#Fabric External MDL2 Assets" Text="&#xEE93;" VerticalAlignment="Center" FontSize="14" TextAlignment="Center" Foreground="#37363d"/>
<TextBlock Margin="5,0,0,0" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" Grid.Column="1" Foreground="#37363d">
<Run Text="{TemplateBinding SelectedYear,Converter={StaticResource StringConverter}}"/><Run Text=""/> <Run Text="{TemplateBinding SelectedMonth,Converter={StaticResource StringConverter}}"/><Run Text=""/>
<Run Text="{TemplateBinding SelectedYear,Converter={StaticResource StringConverter}}"/> <Run Text="/"/> <Run Text="{TemplateBinding SelectedMonth,Converter={StaticResource StringConverter}}"/>
</TextBlock>
</StackPanel>

Expand Down
Loading

0 comments on commit 7808b86

Please sign in to comment.