пятница, 5 декабря 2014 г.

Manco .NET Licensing System version 9.0 announcement - Part 1

Currently we are working on the version 9.0 of the Manco .NET Licensing System. While it is not available publicly I'm going to write a few articles about new features we are planning for this version.

First of all, since version 9.0 we stop supporting .NET Framework 3.5 in the protection library. But you still be able to use new License Manager to generate licenses for applications which use old protection library.

We've made several changes in the protection library which speed the up the license validation process. Version of the protection library for .NET Framework 4.5 now supports the asynchronous license file loading. So you can write something like that:

public MainForm()
   // Instantiate license object
   this.license = new License(this);           
private async void MainForm_Load(object sender, EventArgs e)
{   // First of all we should load license file
   await this.license.LoadAsync();


In the version 9.0 we redesign the UI of the License Manager completely. In the world of tablets and smartphones many our customers moved a customers and sales management to the devices with small screen resolution. Using of the current version of the License Manager on those devices is inconvenient because it has a high density of the information in views. So we decides to redesign UI of the License Manager to make it more tablet-friendly. It doesn't use tree view model anymore, but tile view instead. Here are few screenshots of the main window (you will get more in the upcoming messages):


воскресенье, 27 июля 2014 г.

Manco Shapefile Editor - Integration with Telerik RadMap control for WPF

The projects are created in the Manco Shapefile Editor can be easily loaded into the Telerik RadMap control with just few lines of code.

You may ask why this is necessary. The Telerik RadMap control can load ESRI shape files and KML files. The Manco Shapefile Editor can export shapes into these formats. So at the first glance we need not this extra functionality. But think about following:
  1. The figures in the ESRI shape file format are represented by polylines and polygons. So every curve (ellipse, arc, Bezier curve and so on) created in the editor should be interpolated using polygons. It increases significantly number of the points are used to represent every shape and, as result, increase initial loading time, slowdown zooming in the RadMap, and makes curves look like polygon after some zoom level. In contrast any figures in the Manco Shapefile Editor project can be represented directly using correspondent map shapes in the Telerik RadMap control. So no interpolation is needed to represent shapes. It makes curves look absolutely same way as they were designed in the editor.
  2. Using this feature you can not only load the shapes, but open correspondent map provider and load background images (when necessary) automatically
So this feature significantly simplifies process of the creation applications using Telerik RadMap control and makes resulting picture much better.

To do it:

  1. Create new WPF application.
  2. Add references for the RadMap control:
  3. Add RadBusyIndicator, RadMap control and button to load project into your XAML. Setup bindings for the map properties:<Window x:Class="TestWpfApplication.MainWindow"
        Height="520" Width="650">
        <telerik:RadBusyIndicator Name="busyIndicator">
                 <ColumnDefinition Width="*" />
                 <ColumnDefinition Width="Auto" />
              <telerik:RadMap Name="radMap"
                 Provider="{Binding Provider}"
                 Center="{Binding Center, Mode=TwoWay}"
                 ZoomLevel="{Binding ZoomLevel, Mode=TwoWay}"
                 MouseSelectionMode="RaiseEvent" />
              <Button Grid.Column="1"
                 <TextBlock Margin="4,2,4,2" Text="Load project" />
  4. Add reference to the Manco.MapShapeData.Load.dll.
  5. If you are using newer version of the Telerik RadControls for WPF than it was used to build Manco.MapShapeData.Load .dll then redirect assembly versions for Telerik assemblies as it is described here.
  6. Add code which load project file and bind it to the RadMap control:

private async void OnButtonClick(object sender, RoutedEventArgs e)
   OpenFileDialog openProjectDialog = new OpenFileDialog();
   openProjectDialog.Filter = "ShapeFileEditor Project Files|*.shprj";
   openProjectDialog.Multiselect = false;

   bool? open = openProjectDialog.ShowDialog();
   if (open == true && !string.IsNullOrEmpty(openProjectDialog.FileName))
      await this.LoadProject(
         new Uri(openProjectDialog.FileName, UriKind.RelativeOrAbsolute));

private async Task LoadProject(Uri projectUri)
   this.busyIndicator.IsIndeterminate = true;
   this.busyIndicator.IsBusy = true;

   ProjectInfo info = await ProjectReader.Read(projectUri, this.Dispatcher);

   this.busyIndicator.IsBusy = false;

private void BindProject(ProjectInfo info)
   if (info != null)
      if (info.Errors.Count == 0)
            this.Resources["PointDataTemplate"] as DataTemplate,
         this.radMap.DataContext = info;


Private Sub OnButtonClick(sender As Object, e As RoutedEventArgs)
    Dim openProjectDialog As New OpenFileDialog()
    openProjectDialog.Filter = "ShapeFileEditor Project Files|*.shprj"
    openProjectDialog.Multiselect = False

    Dim open As System.Nullable(Of Boolean) = openProjectDialog.ShowDialog()

    If open = True AndAlso Not String.IsNullOrEmpty(openProjectDialog.FileName) Then
        Await Me.LoadProject(New Uri(openProjectDialog.FileName, UriKind.RelativeOrAbsolute))
    End If
End Sub

Private Function LoadProject(projectUri As Uri) As Task
    Me.busyIndicator.IsIndeterminate = True
    Me.busyIndicator.IsBusy = True

    Dim info As ProjectInfo = Await ProjectReader.Read(projectUri, Me.Dispatcher)

    Me.busyIndicator.IsBusy = False
End Function

Private Sub BindProject(info As ProjectInfo)
    If info IsNot Nothing Then
        If info.Errors.Count = 0 Then
            ProjectReader.CreateLayers(Me.radMap, _
               info, _
               TryCast(Me.Resources("PointDataTemplate"), DataTemplate), Nothing)
            Me.radMap.DataContext = info
        End If
    End If
End Sub

You can find sample solution which implements this approach on our official site at the http://www.mancosoftware.com/ShapeFileEditor/download.htm