Skip to content

Commit bcd7489

Browse files
18.6 Release
2 parents 2f413fd + 32ca291 commit bcd7489

33 files changed

+837
-73
lines changed

Aspose.OMR.Client/Aspose.OMR.Client/Aspose.OMR.Client.csproj

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
</PropertyGroup>
4242
<ItemGroup>
4343
<Reference Include="Aspose.OMR.Cloud.SDK, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
44-
<HintPath>..\packages\Aspose.OMR-Cloud.1.0.3\lib\Aspose.OMR.Cloud.SDK.dll</HintPath>
44+
<HintPath>..\packages\Aspose.OMR-Cloud.1.0.2\lib\Aspose.OMR.Cloud.SDK.dll</HintPath>
4545
</Reference>
46-
<Reference Include="Aspose.Storage.Cloud.Sdk, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
47-
<HintPath>..\packages\Aspose.Storage-Cloud.18.3.0\lib\net20\Aspose.Storage.Cloud.Sdk.dll</HintPath>
46+
<Reference Include="Aspose.Storage-Cloud, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
47+
<HintPath>..\packages\Aspose.Storage-Cloud.1.1.1\lib\Aspose.Storage-Cloud.dll</HintPath>
4848
</Reference>
4949
<Reference Include="Microsoft.VisualBasic" />
5050
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
@@ -75,6 +75,7 @@
7575
<SubType>Designer</SubType>
7676
</ApplicationDefinition>
7777
<Compile Include="Controls\EnumBindingSourceExtension.cs" />
78+
<Compile Include="Controls\OmrBarcodeElement.cs" />
7879
<Compile Include="Controls\OmrGridElement.cs" />
7980
<Compile Include="Converters\BoolToOpacityConverter.cs" />
8081
<Compile Include="Converters\BoolToVisibilityInverseConverter.cs" />
@@ -130,6 +131,7 @@
130131
<Compile Include="Utility\TemplateCreationStages.cs" />
131132
<Compile Include="Utility\TemplateGenerationContent.cs" />
132133
<Compile Include="Utility\UserSettingsUtility.cs" />
134+
<Compile Include="ViewModels\BarcodeViewModel.cs" />
133135
<Compile Include="ViewModels\BaseQuestionViewModel.cs" />
134136
<Compile Include="ViewModels\CorrectionErrorsViewModel.cs" />
135137
<Compile Include="ViewModels\CredentialsViewModel.cs" />
@@ -171,6 +173,9 @@
171173
<Compile Include="Views\AnswersView.xaml.cs">
172174
<DependentUpon>AnswersView.xaml</DependentUpon>
173175
</Compile>
176+
<Compile Include="Views\BarcodePropertiesView.xaml.cs">
177+
<DependentUpon>BarcodePropertiesView.xaml</DependentUpon>
178+
</Compile>
174179
<Compile Include="Views\CommonPropertiesView.xaml.cs">
175180
<DependentUpon>CommonPropertiesView.xaml</DependentUpon>
176181
</Compile>
@@ -238,6 +243,10 @@
238243
<SubType>Designer</SubType>
239244
<Generator>MSBuild:Compile</Generator>
240245
</Page>
246+
<Page Include="Views\BarcodePropertiesView.xaml">
247+
<SubType>Designer</SubType>
248+
<Generator>MSBuild:Compile</Generator>
249+
</Page>
241250
<Page Include="Views\CommonPropertiesView.xaml">
242251
<SubType>Designer</SubType>
243252
<Generator>MSBuild:Compile</Generator>

Aspose.OMR.Client/Aspose.OMR.Client/Controls/CustomCanvas.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ protected override void OnMouseMove(MouseEventArgs e)
113113
{
114114
this.mode = SelectionRectnagleModes.Grid;
115115
}
116+
else if (dataContext.IsAddingBarcode)
117+
{
118+
this.mode = SelectionRectnagleModes.Barcode;
119+
}
116120

117121
RubberbandAdorner adorner = new RubberbandAdorner(this, this.dragStartPoint, this.mode);
118122
adorner.MouseUp += this.AdornerMouseUp;

Aspose.OMR.Client/Aspose.OMR.Client/Controls/MoveThumb.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,17 @@ private void MoveThumbDragDelta(object sender, DragDeltaEventArgs e)
141141
content = VisualTreeHelper.GetParent(grid);
142142
}
143143

144-
// presenter that holds omr item
145-
ContentPresenter presenter = (ContentPresenter) VisualTreeHelper.GetParent(content);
144+
ContentPresenter presenter;
145+
146+
if (content is ContentPresenter)
147+
{
148+
presenter = (ContentPresenter) content;
149+
}
150+
else
151+
{
152+
// presenter that holds omr item
153+
presenter = (ContentPresenter)VisualTreeHelper.GetParent(content);
154+
}
146155

147156
// parent canvas
148157
CustomCanvas canvas = (CustomCanvas) VisualTreeHelper.GetParent(presenter);
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* Copyright (c) 2018 Aspose Pty Ltd. All Rights Reserved.
3+
*
4+
* Licensed under the MIT (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://github.com/aspose-omr-cloud/aspose-omr-cloud-dotnet/blob/master/LICENSE
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
using System;
17+
using System.Collections.Generic;
18+
using System.Linq;
19+
using System.Text;
20+
using System.Threading.Tasks;
21+
using System.Windows.Documents;
22+
using System.Windows.Input;
23+
24+
namespace Aspose.OMR.Client.Controls
25+
{
26+
public class OmrBarcodeElement : BaseOmrElement
27+
{
28+
/// <summary>
29+
/// Add or remove adorners based on selection
30+
/// </summary>
31+
/// <param name="isSelected">IsSelected property value</param>
32+
protected override void UpdateAdorners(bool isSelected)
33+
{
34+
if (isSelected)
35+
{
36+
this.AddAdorners();
37+
}
38+
else
39+
{
40+
this.ClearAdorners();
41+
}
42+
}
43+
44+
/// <summary>
45+
/// Handles preview mouse down event
46+
/// </summary>
47+
/// <param name="e">The event args</param>
48+
protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
49+
{
50+
base.OnPreviewMouseDown(e);
51+
52+
// update selection
53+
if ((Keyboard.Modifiers & (ModifierKeys.Shift | ModifierKeys.Control)) != ModifierKeys.None)
54+
{
55+
// if key modifiers used -> reverse selection (select if was unselected and vice versa)
56+
this.IsSelected = !this.IsSelected;
57+
}
58+
else if (!this.IsSelected)
59+
{
60+
// no modifiers used and item wasn't selected -> clear selection on canvas and select item
61+
ControlHelper.FindParentCanvas(this).ClearSelection();
62+
this.IsSelected = true;
63+
}
64+
65+
this.Focus();
66+
e.Handled = false;
67+
}
68+
69+
/// <summary>
70+
/// Adds question adorner to adorner layer
71+
/// Can be customized with specific adorner
72+
/// </summary>
73+
private void AddAdorners()
74+
{
75+
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
76+
QuestionAdorner adorner = new QuestionAdorner(this);
77+
adornerLayer.Add(adorner);
78+
}
79+
80+
/// <summary>
81+
/// Removes all adorners from adorner layer
82+
/// </summary>
83+
private void ClearAdorners()
84+
{
85+
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
86+
Adorner[] adorners = adornerLayer.GetAdorners(this);
87+
88+
if (adorners != null)
89+
{
90+
foreach (Adorner adorner in adorners)
91+
{
92+
adornerLayer.Remove(adorner);
93+
}
94+
}
95+
}
96+
}
97+
}

Aspose.OMR.Client/Aspose.OMR.Client/Controls/QuestionAdorner.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ public class QuestionAdorner : Adorner
5656
/// </summary>
5757
private Thumb fullDotsResizeThumb;
5858

59+
/// <summary>
60+
/// Type of adorned question
61+
/// </summary>
62+
private Type elementType;
63+
5964
/// <summary>
6065
/// Initializes a new instance of the <see cref="QuestionAdorner"/> class.
6166
/// </summary>
@@ -71,6 +76,8 @@ public QuestionAdorner(UIElement adornedElement) : base(adornedElement)
7176
}
7277
);
7378

79+
this.elementType = adornedElement.GetType();
80+
7481
this.visualChildren = new VisualCollection(this);
7582
this.scale = TemplateViewModel.ZoomKoefficient;
7683

@@ -159,7 +166,18 @@ private void BuildTextMoveThumb()
159166
{
160167
this.textMoveThumb = new MoveThumb();
161168
this.textMoveThumb.Cursor = Cursors.SizeAll;
162-
this.textMoveThumb.Template = Application.Current.FindResource("MoveTextTemplate") as ControlTemplate;
169+
170+
if (this.elementType == typeof(OmrBarcodeElement))
171+
{
172+
this.textMoveThumb.Template =
173+
Application.Current.FindResource("MoveTextBarcodeTemplate") as ControlTemplate;
174+
}
175+
else
176+
{
177+
this.textMoveThumb.Template =
178+
Application.Current.FindResource("MoveTextTemplate") as ControlTemplate;
179+
}
180+
163181
this.visualChildren.Add(this.textMoveThumb);
164182
}
165183

Aspose.OMR.Client/Aspose.OMR.Client/Controls/RubberbandAdorner.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,17 @@ public RubberbandAdorner(CustomCanvas canvas, Point? dragStartPoint, SelectionRe
8080
break;
8181
}
8282

83+
case SelectionRectnagleModes.Barcode:
84+
{
85+
this.rubberandBrush = (Brush)Application.Current.FindResource("BarcodeBrush");
86+
this.toSelect = false;
87+
break;
88+
}
89+
8390
case SelectionRectnagleModes.Grid:
8491
{
8592
this.rubberandBrush = (Brush)Application.Current.FindResource("MainItemsBrush");
86-
this.toSelect = false;
93+
this.toSelect = false;
8794
break;
8895
}
8996
}

Aspose.OMR.Client/Aspose.OMR.Client/Converters/BoolToVisibilityConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
3636
}
3737
else
3838
{
39-
return Visibility.Hidden;
39+
return Visibility.Collapsed;
4040
}
4141
}
4242

Aspose.OMR.Client/Aspose.OMR.Client/Properties/Resources.Designer.cs

Lines changed: 2 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Aspose.OMR.Client/Aspose.OMR.Client/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@
121121
<value>RootCanvas</value>
122122
</data>
123123
<data name="Version" xml:space="preserve">
124-
<value>18.4</value>
124+
<value>18.6</value>
125125
</data>
126126
</root>

Aspose.OMR.Client/Aspose.OMR.Client/Resources/OmrItemStyle.xaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,30 @@
66
<Color x:Key="MainItemsColor" >#FF87CEFA</Color>
77
<Color x:Key="SelectionColor" >#FF778899</Color>
88
<Color x:Key="InvalidBubbleColor" >#FFFF0000</Color>
9+
<Color x:Key="BarcodeElementColor" >LightSkyBlue</Color>
910

1011
<SolidColorBrush Color="{StaticResource MainItemsColor}" x:Key="MainItemsBrush"/>
12+
<SolidColorBrush Color="{StaticResource BarcodeElementColor}" x:Key="BarcodeBrush"/>
1113
<SolidColorBrush Color="{StaticResource SelectionColor}" x:Key="SelectionBrush"/>
1214
<SolidColorBrush Color="{StaticResource InvalidBubbleColor}" x:Key="InvalidBubbleBrush"/>
1315

1416

1517
<!--Template for text panel used for dragging questions-->
1618
<ControlTemplate TargetType="{x:Type Thumb}" x:Key="MoveTextTemplate">
1719
<TextBlock Text="{Binding Name}"
18-
MinWidth="20" Width="200" Margin="0, 0, 0, 0"
20+
MinWidth="20" Width="200" Margin="0, 0, 0, 0" FontSize="16"
1921
Background="{StaticResource MainItemsBrush}" Height="20" Opacity="0.8"
2022
HorizontalAlignment="Left" VerticalAlignment="Top"/>
2123
</ControlTemplate>
2224

25+
<!--Template for text panel used for dragging questions-->
26+
<ControlTemplate TargetType="{x:Type Thumb}" x:Key="MoveTextBarcodeTemplate">
27+
<TextBlock Text="{Binding Name}"
28+
MinWidth="20" Width="200" Margin="0, 0, 0, 0" FontSize="16"
29+
Background="{StaticResource BarcodeBrush}" Height="20" Opacity="0.7"
30+
HorizontalAlignment="Left" VerticalAlignment="Top"/>
31+
</ControlTemplate>
32+
2333
<!--Template for resize thumb used to resize questions-->
2434
<ControlTemplate x:Key="FullDotsResizeTemplate" TargetType="{x:Type Thumb}">
2535
<Grid Opacity="1" SnapsToDevicePixels="true">
@@ -70,6 +80,12 @@
7080
</Grid>
7181
</ControlTemplate>
7282

83+
<ControlTemplate TargetType="{x:Type Thumb}" x:Key="BarcodeMoveThumb">
84+
<Grid SnapsToDevicePixels="True" Background="Transparent">
85+
<Rectangle Fill="{StaticResource BarcodeBrush}" Opacity="0.7"/>
86+
</Grid>
87+
</ControlTemplate>
88+
7389
<!--Style of omr choicebox-->
7490
<Style TargetType="{x:Type controls:OmrChoiceBox}" x:Key="ChoiceBoxStyle">
7591
<Setter Property="MinHeight" Value="20"/>
@@ -89,6 +105,20 @@
89105
</Setter>
90106
</Style>
91107

108+
<!--Style of omr barcode-->
109+
<Style TargetType="{x:Type controls:OmrBarcodeElement}" x:Key="BarcodeStyle">
110+
<Setter Property="MinHeight" Value="20"/>
111+
<Setter Property="MinWidth" Value="20"/>
112+
<Setter Property="SnapsToDevicePixels" Value="true"/>
113+
<Setter Property="Template">
114+
<Setter.Value>
115+
<ControlTemplate TargetType="{x:Type controls:OmrBarcodeElement}">
116+
<controls:MoveThumb x:Name="MoveThumb" Cursor="SizeAll" Template="{StaticResource BarcodeMoveThumb}"/>
117+
</ControlTemplate>
118+
</Setter.Value>
119+
</Setter>
120+
</Style>
121+
92122
<!--Style of omr grid-->
93123
<Style TargetType="{x:Type controls:OmrGridElement}" x:Key="GridStyle">
94124
<Setter Property="MinHeight" Value="20"/>

0 commit comments

Comments
 (0)