I have a form that performs a specific task on form load. This is working properly. My question is, how do I disable/ignore this form load if I'm trying to open a submitted form. I only need to run the below code on creation.
using Microsoft.Office.InfoPath;
using System;
using System.Xml;
using System.Xml.XPath;
namespace WorkOrder
{
public partial class FormCode
{
// Member variables are not supported in browser-enabled forms.
// Instead, write and read these values from the FormState
// dictionary using code such as the following:
//
// private object _memberVariable
// {
// get
// {
// return FormState["_memberVariable"];
// }
// set
// {
// FormState["_memberVariable"] = value;
// }
// }
// NOTE: The following procedure is required by Microsoft InfoPath.
// It can be modified using Microsoft InfoPath.
public void InternalStartup()
{
EventManager.FormEvents.Loading += new LoadingEventHandler(FormEvents_Loading);
}
public void FormEvents_Loading(object sender, LoadingEventArgs e)
{
// Be sure that the InputParameter dictionary contains
// values before proceeding.
bool FormEvents_Loading;
if (e.InputParameters.Count != 0)
{
string vDate = e.InputParameters["Date"];
string vCont = e.InputParameters["Cont"];
XPathNavigator myNav = CreateNavigator();
myNav.SelectSingleNode("/my:myFields/my:Reps/my:Contractor",NamespaceManager).SetValue(vCont);
myNav.SelectSingleNode("/my:myFields/my:Service/my:Date", NamespaceManager).SetValue(vDate);
}
}
}
}