|
@@ -17,6 +17,9 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
|
|
|
public class BackgroundCreateColorContentViewModel : BindableBase, INavigationAware
|
|
public class BackgroundCreateColorContentViewModel : BindableBase, INavigationAware
|
|
{
|
|
{
|
|
|
|
+ private string RedColorBtn = "RedColorBtn";
|
|
|
|
+ private string GreenColorBtn = "GreenColorBtn";
|
|
|
|
+
|
|
private List<string> _rotationList = new List<string>();
|
|
private List<string> _rotationList = new List<string>();
|
|
public List<string> RotationList
|
|
public List<string> RotationList
|
|
{
|
|
{
|
|
@@ -44,35 +47,61 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private int _rotationNumber = 0;
|
|
|
|
- public int RotationNumber
|
|
|
|
|
|
+ private int _rotationValue = 0;
|
|
|
|
+ public int RotationValue
|
|
|
|
+ {
|
|
|
|
+ get { return _rotationValue; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _rotationValue, value);
|
|
|
|
+ BackgroundInfo.Rotation = value;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private int _opacityValue = 100;
|
|
|
|
+ public int OpacityValue
|
|
|
|
+ {
|
|
|
|
+ get { return _opacityValue; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _opacityValue, value);
|
|
|
|
+ BackgroundInfo.Opacity = (byte)((float)(value / 100) * 255);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private int _relativeRatioValue = 0;
|
|
|
|
+ public int RelativeRatioValue
|
|
{
|
|
{
|
|
- get { return _rotationNumber; }
|
|
|
|
|
|
+ get { return _relativeRatioValue; }
|
|
set
|
|
set
|
|
{
|
|
{
|
|
- SetProperty(ref _rotationNumber, value);
|
|
|
|
|
|
+ SetProperty(ref _rotationValue, value);
|
|
|
|
+ BackgroundInfo.RelativeRatio = value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private int _opacityNumber = 100;
|
|
|
|
- public int OpacityNumber
|
|
|
|
|
|
+ private int _horizontalOffsetValue = 0;
|
|
|
|
+ public int HorizontalOffsetValue
|
|
{
|
|
{
|
|
- get { return _opacityNumber; }
|
|
|
|
- set { SetProperty(ref _opacityNumber, value); }
|
|
|
|
|
|
+ get { return _horizontalOffsetValue; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _horizontalOffsetValue, value);
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- private int _relativeRatioNumber = 0;
|
|
|
|
- public int RelativeRatioNumber
|
|
|
|
|
|
+ private int _verticalOffsetValue = 0;
|
|
|
|
+ public int VerticalOffsetValue
|
|
{
|
|
{
|
|
- get { return _relativeRatioNumber; }
|
|
|
|
- set { SetProperty(ref _rotationNumber, value); }
|
|
|
|
|
|
+ get { return _verticalOffsetValue; }
|
|
|
|
+ set { SetProperty(ref _verticalOffsetValue, value); }
|
|
}
|
|
}
|
|
|
|
|
|
private ObservableDictionary<string, bool> _getLocationFromNumber = new ObservableDictionary<string, bool>();
|
|
private ObservableDictionary<string, bool> _getLocationFromNumber = new ObservableDictionary<string, bool>();
|
|
public ObservableDictionary<string, bool> GetLocationFromNumber
|
|
public ObservableDictionary<string, bool> GetLocationFromNumber
|
|
{
|
|
{
|
|
- get { return _getLocationFromNumber;}
|
|
|
|
- set { _getLocationFromNumber = value; }
|
|
|
|
|
|
+ get { return _getLocationFromNumber; }
|
|
}
|
|
}
|
|
|
|
|
|
private BackgroundInfo _backgroundInfo = new BackgroundInfo();
|
|
private BackgroundInfo _backgroundInfo = new BackgroundInfo();
|
|
@@ -82,11 +111,27 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
set { _backgroundInfo = value; }
|
|
set { _backgroundInfo = value; }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private string _stringColor = "#FFFF0000";
|
|
|
|
+ public string StringColor
|
|
|
|
+ {
|
|
|
|
+ get
|
|
|
|
+ {
|
|
|
|
+ return _stringColor;
|
|
|
|
+ }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _stringColor, value);
|
|
|
|
+ BackgroundInfo.Color = EditToolsHelper.ConvertColor(value); ;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
public DelegateCommand<object> ChangeLocationCommand { get; set; }
|
|
public DelegateCommand<object> ChangeLocationCommand { get; set; }
|
|
|
|
+ public DelegateCommand<object> ChangeColorCommand { get; set; }
|
|
|
|
|
|
- public BackgroundCreateColorContentViewModel(){
|
|
|
|
|
|
+ public BackgroundCreateColorContentViewModel()
|
|
|
|
+ {
|
|
ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
|
|
ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
|
|
|
|
+ ChangeColorCommand = new DelegateCommand<object>(ChangeColor);
|
|
InitComponent();
|
|
InitComponent();
|
|
BackgroundInfo.BackgroundHorizalign = C_Background_Horizalign.BG_HORIZALIGN_CENTER;
|
|
BackgroundInfo.BackgroundHorizalign = C_Background_Horizalign.BG_HORIZALIGN_CENTER;
|
|
BackgroundInfo.BackgroundVertalign = C_Background_Vertalign.BG_VERTALIGN_CENTER;
|
|
BackgroundInfo.BackgroundVertalign = C_Background_Vertalign.BG_VERTALIGN_CENTER;
|
|
@@ -123,24 +168,23 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
RelativeRatioList.Clear();
|
|
RelativeRatioList.Clear();
|
|
for (int defaultRelativeRatioList = 10; defaultRelativeRatioList <= 100; defaultRelativeRatioList += 10)
|
|
for (int defaultRelativeRatioList = 10; defaultRelativeRatioList <= 100; defaultRelativeRatioList += 10)
|
|
{
|
|
{
|
|
- OpacityList.Add(defaultRelativeRatioList.ToString() + " %");
|
|
|
|
|
|
+ RelativeRatioList.Add(defaultRelativeRatioList.ToString() + " %");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private void InitLocationButtonMatrix()
|
|
private void InitLocationButtonMatrix()
|
|
{
|
|
{
|
|
GetLocationFromNumber.Clear();
|
|
GetLocationFromNumber.Clear();
|
|
- for(var temp = 0; temp <= 22; temp++)
|
|
|
|
|
|
+ for (var temp = 0; temp <= 22; temp++)
|
|
{
|
|
{
|
|
GetLocationFromNumber.Add(temp.ToString(), true);
|
|
GetLocationFromNumber.Add(temp.ToString(), true);
|
|
- if(temp%10 == 2)
|
|
|
|
|
|
+ if (temp % 10 == 2)
|
|
{
|
|
{
|
|
temp += 7;
|
|
temp += 7;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- int Num =(int)BackgroundInfo.BackgroundVertalign * 10 + (int)BackgroundInfo.BackgroundHorizalign;
|
|
|
|
|
|
+ int Num = (int)BackgroundInfo.BackgroundVertalign * 10 + (int)BackgroundInfo.BackgroundHorizalign;
|
|
GetLocationFromNumber[Num.ToString()] = false;
|
|
GetLocationFromNumber[Num.ToString()] = false;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void ChangeLocation(object e)
|
|
public void ChangeLocation(object e)
|
|
@@ -154,6 +198,22 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void ChangeColor(object e)
|
|
|
|
+ {
|
|
|
|
+ var args = e as System.Windows.Controls.Button;
|
|
|
|
+ if (args != null)
|
|
|
|
+ {
|
|
|
|
+ if (args.Name == RedColorBtn)
|
|
|
|
+ {
|
|
|
|
+ StringColor = "#FF0000";
|
|
|
|
+ }
|
|
|
|
+ else if (args.Name == GreenColorBtn)
|
|
|
|
+ {
|
|
|
|
+ StringColor = "#008000";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
{
|
|
{
|
|
return true;
|
|
return true;
|