|
@@ -56,30 +56,64 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private int _rotationNumber = 0;
|
|
|
- public int RotationNumber
|
|
|
+ private int _rotationValue = 0;
|
|
|
+ public int RotationValue
|
|
|
{
|
|
|
- get { return _rotationNumber; }
|
|
|
+ get { return _rotationValue; }
|
|
|
set
|
|
|
{
|
|
|
- SetProperty(ref _rotationNumber, value);
|
|
|
+ SetProperty(ref _rotationValue, value);
|
|
|
+ BackgroundInfo.Rotation = ((float)RotationValue / 180) * 3.1415926f;
|
|
|
+ eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private int _opacityNumber = 100;
|
|
|
- public int OpacityNumber
|
|
|
+
|
|
|
+ private int _opacityValue = 100;
|
|
|
+ public int OpacityValue
|
|
|
+ {
|
|
|
+ get { return _opacityValue; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref _opacityValue, value);
|
|
|
+ BackgroundInfo.Opacity = (byte)(((float)OpacityValue / 100) * 225);
|
|
|
+ eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private int _relativeRatioValue = 0;
|
|
|
+ public int RelativeRatioValue
|
|
|
{
|
|
|
- get { return _opacityNumber; }
|
|
|
- set { SetProperty(ref _opacityNumber, value); }
|
|
|
+ get { return _relativeRatioValue; }
|
|
|
+ set { SetProperty(ref _relativeRatioValue, value); }
|
|
|
}
|
|
|
|
|
|
- private int _relativeRatioNumber = 0;
|
|
|
- public int RelativeRatioNumber
|
|
|
+ private string _verticalOffsetValue = "0";
|
|
|
+ public string VerticalOffsetValue
|
|
|
{
|
|
|
- get { return _relativeRatioNumber; }
|
|
|
- set { SetProperty(ref _rotationNumber, value); }
|
|
|
+ get { return _verticalOffsetValue; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref _verticalOffsetValue, value);
|
|
|
+ BackgroundInfo.VertOffset = float.Parse(VerticalOffsetValue);
|
|
|
+ eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ private string _horizOffsetValue = "0";
|
|
|
+ public string HorizontalOffsetValue
|
|
|
+ {
|
|
|
+ get { return _horizOffsetValue; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref _horizOffsetValue, value);
|
|
|
+ BackgroundInfo.HorizOffset = float.Parse(HorizontalOffsetValue);
|
|
|
+ eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private ObservableDictionary<string, bool> _getLocationFromNumber = new ObservableDictionary<string, bool>();
|
|
|
public ObservableDictionary<string, bool> GetLocationFromNumber
|
|
|
{
|
|
@@ -118,7 +152,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
public BackgroundCreateFileContentViewModel(IEventAggregator eventAggregator)
|
|
|
{
|
|
|
this.eventAggregator = eventAggregator;
|
|
|
-
|
|
|
+ BackgroundInfo.BackgroundType = C_Background_Type.BG_TYPE_IMAGE;
|
|
|
ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
|
|
|
InitComponent();
|
|
|
BackgroundInfo.Horizalign = C_Background_Horizalign.BG_HORIZALIGN_CENTER;
|
|
@@ -200,6 +234,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
{
|
|
|
BackgroundInfo.Vertalign = (C_Background_Vertalign)(int.Parse(args) / 10);
|
|
|
BackgroundInfo.Horizalign = (C_Background_Horizalign)(int.Parse(args) % 10);
|
|
|
+ eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
|
|
|
InitLocationButtonMatrix();
|
|
|
}
|
|
|
}
|
|
@@ -222,6 +257,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
EditToolsHelper.ChooseFile(dlg.FileName, ref BackgroundInfo);
|
|
|
}
|
|
|
CreateModFileVisible = Visibility.Visible;
|
|
|
+ eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -241,12 +277,26 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
document.Release();
|
|
|
}
|
|
|
|
|
|
+ public void ConvertInfoToItem(ref BackgroundItem backgroundItem, BackgroundInfo backgroundInfo)
|
|
|
+ {
|
|
|
+ backgroundItem.type = backgroundInfo.BackgroundType;
|
|
|
+ backgroundItem.bgColor = backgroundInfo.Color;
|
|
|
+ backgroundItem.pageRange = backgroundInfo.PageRange;
|
|
|
+ backgroundItem.horizalign = backgroundInfo.Horizalign;
|
|
|
+ backgroundItem.vertalign = backgroundInfo.Vertalign;
|
|
|
+ backgroundItem.vertOffset = backgroundInfo.VertOffset;
|
|
|
+ backgroundItem.horizalign = backgroundInfo.Horizalign;
|
|
|
+ backgroundItem.opacity = backgroundInfo.Opacity;
|
|
|
+ backgroundItem.rotation = backgroundInfo.Rotation;
|
|
|
+ backgroundItem.scale = backgroundInfo.Scale;
|
|
|
+ // backgroundItem.pagRangeMode = backgroundInfo.PageRange;
|
|
|
+ }
|
|
|
+
|
|
|
public void SaveCurrentTemplate()
|
|
|
{
|
|
|
var backgroundItem = new BackgroundItem();
|
|
|
- backgroundItem.pageRange = "0";
|
|
|
- backgroundItem.type = ComPDFKit.PDFDocument.C_Background_Type.BG_TYPE_IMAGE;
|
|
|
- backgroundItem.templateName += Settings.Default.BackgroundIndex.ToString();
|
|
|
+ ConvertInfoToItem(ref backgroundItem, BackgroundInfo);
|
|
|
+ backgroundItem.templateName += Settings.Default.WatermarkIndex.ToString();
|
|
|
Settings.Default.BackgroundTemplateList.Add(backgroundItem);
|
|
|
Settings.Default.Save();
|
|
|
this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(EnumTemplateListOrCreate.StatusTemplate);
|
|
@@ -254,12 +304,11 @@ namespace PDF_Office.ViewModels.EditTools.Background
|
|
|
|
|
|
public void SaveBackgroundTemplate(EnumColorOrFile enumColorOrFile)
|
|
|
{
|
|
|
- if (enumColorOrFile == EnumColorOrFile.StatusFile)
|
|
|
+ if (enumColorOrFile == EnumColorOrFile.StatusColor)
|
|
|
{
|
|
|
SaveCurrentTemplate();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
|
{
|
|
|
return true;
|