Click here to Skip to main content
15,867,594 members
Articles / Programming Languages / C#

modds Drag and Drop Programming for C# Debugging (Part 4)

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
1 Aug 2016CPOL2 min read 9.1K   2   2
Visual Programming Language

Introduction

In modds Drag and Drop Programming for C# Sample Stock Chart Auto Completion (part 3), I show an example of adding auto completion to Stock Chart Program. As the program gets more complicated, we need ways to debug and step into the codes. 

Project Requirements

Debugging the modds Project

Simple Pop Up Windows

With modds Designer, you can use Inspection Tools->ToStringMessageBox at Control Toolbox panel to check if a control receives data or not.

Example: Connect a Message Box to SearchCommand on StockChartAutoComplete example.

Image 1

In this example, the black line's connection index is set to 0 and the blue line's connection index is set to 1. This means the data will flow to Message Box first before it flows to YahooDailyMarketData.

On StockChartAutoComplete program UI, the search button is data binded to SearchCommand control.  When user presses the search button, the Message Box will pop up. The Message Box will stop the data flow until user presses the OK button in it. This is the simplest way to see if you have a data flow on connected control.

Generated Code

When modds program compiled in DEBUG mode, all code written with Scripts->C# Script control will generate a .cs file. Those files are located at Project Director-> Build->Debug->Scripts->ProgramScript-><Module filename.cs>.

Image 2

You can use Microsoft Visual Studio to open the .cs file and set break point on it. 

Step In To the Generated Code

  1. Using modds Designer to open StockChartAutoComplete example project.
  2. Right click on the project and select Debug to run.
  3. Using Microsoft Visual Studio to open the following .cs file.

    StockChartAutoComplete(Director)->Build->Debug->Scripts->ProgramScript->MainWindows.cs

  4. Set break point at the beginning of function GetKeyInText.
  5. At Microsoft Visual Studio Debug->Attach to Process… to attach the running program StockChartAutoComplete
  6. On StockChartAutoComplete execution window, type a character at Stock textbox.

Image 3

The Microsoft Visual Studio should break at GetKeyInText function.

Start Debugger at Program Startup

On StockChartAutoComplete project, the Log.xsml object instance is created at program startup.

Open StockChartAutoComplete project and open(double click) Application.moddc.  You can see the following line:

XML
<PreloadObject Path="Schema\Log.xsml" />

The PreloadObject line tells modds object builder to create the path module object before creating the MAIN object. In this example, the Log.xsml is created before the MAIN (MainWindow.xsml). We can launch the Microsoft Debugger at Log.xsml.

  1. Open Log.xsml
  2. On Control Toolbox panel, drag in modds Common Controls->Start Trigger
  3. On Control Toolbox panel, drag in Scripts->C# Script and enter the following code
Using Panel
C#
using System;
using System.Diagnostics;
Code Panel
C#
static public void StartDebugger()
{
    Debugger.Launch();
}

Connect controls as follows:

Image 4

Run StockChartAutoComplete in Debug, the Microsoft Visual Studio will start and attach to the running program.

modds Drag and Drop Programming for C# Creating Class Library (DLL) - Part 5

 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionneed to see the input and output values on a box/addon in debugging mode Pin
Kelly Kelly3-Aug-16 6:29
Kelly Kelly3-Aug-16 6:29 
AnswerRe: need to see the input and output values on a box/addon in debugging mode Pin
douglas young3-Aug-16 6:53
douglas young3-Aug-16 6:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.