GTP.NET Gantt_ASP upgraded to use AjaxControlToolkit 16.x

This is all for the better but requires some changes to you current project.

When you use the Gantt_ASP you would have had something like this in your aspx page:

image

We need to change it since the AjaxControlToolkit does not need the special ToolkitScriptManager any longer and it does not exist in the namespace.

Also the names of the scripts we rely on to move around time items has change names.

Your code should look like below if you use plexityHide.GTP.dll’s from after this date 2016-06-11.

image

Summary:

  • Replace ToolkitScriptManager with ScriptManager
  • Drop the attributes of ScriptManager ; CombineScripts and ScriptMode
  • Change Common.Common.js to Common.js
  • Change Compat.DragDrop.DragDropScripts.js to Compat.DragDrop.js
  • Increase your applications .net version to 4.5

Auto row scrolling

When you drag a time item outside of the screen – in the time direction – you auto scroll in time. But when dragging the time item out of screen to the top or bottom we should auto scroll rows.

This needs a new event since we are not really sure exactly how the Gantt Rows are grouped to form a Gantt chart – you can use any control like a DataGrid or a ListView to group the rows.

This is one example of how to implement row scrolling with the new event:

    private void _GanttControl_OnConsiderRowAutoScroll(object sender, OnConsiderRowAutoScrollArgs e)
    {
    
      var trans= e.TimeItem.TransformToVisual(_GanttControl);
      var posInGanttCoords = trans.Transform(new Point(0, 0));
      if (posInGanttCoords.Y < _GanttControl.DateScaler.ActualHeight)
      {
        // scroll up
        ControlTemplate template = this._ItemsControl.Template;
        ScrollViewer scrollViewer = (ScrollViewer)template.FindName("_ScrollViewer", this._ItemsControl);
        scrollViewer.LineUp();       
        e.ScrollDoneReMeassure = true;
      }

      if (posInGanttCoords.Y > _GanttControl.ActualHeight)
      {
        //scroll down
        ControlTemplate template = this._ItemsControl.Template;
        ScrollViewer scrollViewer = (ScrollViewer)template.FindName("_ScrollViewer", this._ItemsControl);
        scrollViewer.LineDown();
        e.ScrollDoneReMeassure = true;
      }

    }

 

In this particular case the Gantt is held in a ItemsControl that has a scrollviewer that has the name of _ScrollViewer. So the new Event OnConsiderRowAutoScroll is called whenever the TimeItem is dragged of the GanttRow.

Then we need to check if the TimeItem should initiate an AutoScroll – and if it does we need to scroll and set the flag e.ScrollDoneReMeassure=true – this way the Gantt knows that the worlds has changed.

image

How are images delivered to the Gantt_ASP

Gantt_ASP uses generated images to build up the view.

The images used to come from an aspx page called GTPImg.aspx

This is no longer the case. Instead images are served up by a handler called GetImage.ashx.

Handlers are defined in the config file. The old developer server (before IIS Express) had a different way to define the handler.

Check the config file below if you have any problems to get images to show.

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <!-- this section needed for iis7-->
    <handlers>
      <add name="GetImage" verb="*" path="GetImage.ashx" 
type="PlexityHide.GTP.WEB.GetImage, PlexityHide.GTP.WEB" /> </handlers> </system.webServer> <appSettings /> <connectionStrings /> <system.web> <!-- this section needed for developer server <httpHandlers> <add verb="*" path="GetImage.ashx" type="PlexityHide.GTP.WEB.GetImage, PlexityHide.GTP.WEB" /> </httpHandlers> -->

GTP.NET 6 – 2015

Summary of recent news in GTP.NET

When TimeScrollUse is true a scrollbar is added to allow scroll in time from TimeScrollMinDate to TimeScrollMaxDate

image

TimeItemStyle.RowHeightScale – To better facilitate use of screen space and time precision a new time item drawing style has been added.
In this style the drawing is divided into multiple rectangles – one per lower scale band – and the end parts are drawn as a schedule – both for start and end.
This allows users to have greater precision on move and resize:

image

Gantt_ASP

Gantt_ASP now use handler to serve up images and deals with error that IE10 & 11 use doubles as coordinates where as Chrome and FF use integers

 

RightToLeft support for the whole Gantt including Grid and Printing:

image

Runtime key–to remove runtime marking from GTP.NET

When you run newer versions of GTP.NET you get a button in the date scaler:

image

To remove this button from your production system you need a runtime key.

Runtime keys are free for registered users of GTP.NET.

This is how you create a runtime key

Visit this site: https://licenseandticket.azurewebsites.net/

Find the runtime key menu:

image

Enter you key – choose product (GTP.NET) – Generate key – copy the resulting key

image

In your application code do something like this – do this BEFORE component creation. You only need to do it once per application:

        public WinForm()
        {
            RuntimeKey.Check.Register("YOUR-GTPNET-KEY==", "THE LONG GENERATED KEY FROM ABOVE =");
        }

 

FAQ: But why? It is not fair that some use the GTP.NET without sharing the cost of maintenance.
The runtime key makes it easier for all users to remember to acquire a license and help share the cost of maintenance.

Limit TimeItem change to whole days

        private void gantt1_OnTimeItem_Hoover(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
        {
            if (aGantt.MouseMoveKind == MouseMoveKind.move)
            {
                textBoxEvents.Text = "Moving a time item";
                DateTime suggestedStart=gantt1.DateScaler.PixelToTime(e.x);
                // but we do not accept the suggested start - we want it to differ in complete days...
                double totaldays=Math.Round((e.TimeItem.Start - gantt1.DateScaler.PixelToTime(e.x)).TotalDays);
                e.x = gantt1.DateScaler.TimeToPixel(e.TimeItem.Start - new TimeSpan((int)totaldays,0,0,0));
            }