If anyone was curious how to use a checkbox on the properties panel for a custom activity, apply the following code (replace “Close_Application” for your use case):
// Check to close word (all documents will be closed)
// Uncheck to close only the document in question and word app remains open
[Category("Options")]
[DefaultValue(false)]
public bool Close_Application
{
get;
set;
}
And then simply use your checkbox boolean like so:
if (Close_Application)
{
// Do your stuff
}
Note that InArgument will render a textbox, not a checkbox!
See below. It either closes an active word document, or it closes the word application.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using System.ComponentModel;
using Word = Microsoft.Office.Interop.Word;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.IO;
namespace CustomWordActivities
{
public class CloseActiveDocument : CodeActivity
{
// Check to close word (all documents will be closed)
// Uncheck to close only the document in question and word app remains open
[Category(“Options”)]
[DefaultValue(false)]
public bool CloseApp
{
get;
set;
}
Thanks for your reply, but I mean I want to learn how to do this bool value in the designer. .
I have a problem with this picture. I have added resources (</sap:ActivityDesigner.Resources>) and I can’t achieve it. . .