Show LogFile.cs syntax highlighted
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using TrackerDllLib;
namespace New_Study_Project
{
public class LogFile
{
public enum Context {InStorageTerritory, InFuzzyBoundary, OutsideTerritory};
private string logname;
private StreamWriter output;
//private Tracker3d irTracker;
private double irX, irY, irZ;
public LogFile(int groupID, int trialNum, StartupScreen.StorageType storage, StartupScreen.MaterialType material, StartupScreen.DisplayType display)
{
this.logname = "Log\\g"+groupID.ToString()+"_t"+trialNum+"_D"+System.DateTime.Now.Month+"_"+System.DateTime.Now.Day+"_"+System.DateTime.Now.Year+"_T"+System.DateTime.Now.Hour+"_"+System.DateTime.Now.Minute+".log";
output = new StreamWriter(logname, false, System.Text.Encoding.Default);
output.WriteLine("*****************************************");
output.WriteLine("* Logfile for Storage Territory Study *");
output.WriteLine("*****************************************");
output.WriteLine(" ");
output.WriteLine("Date: "+System.DateTime.Today.ToShortDateString());
output.WriteLine(" ");
output.WriteLine("Trial Information:");
output.WriteLine("Group: "+groupID.ToString()+", Trial: "+trialNum+", Storage: "+storage.ToString()+", Materials: "+material.ToString()+", Display Cond: "+display.ToString());
output.WriteLine(" ");
output.WriteLine("Trial Activity:");
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ BEGIN TRIAL");
//output.Close();
// Initialize IR Tracker on tracking machine ~ make sure the IP address is correct.
//TrackerDllLib.RemoteTracker3D remoteTracker = new TrackerDllLib.RemoteTracker3D();
//irTracker = remoteTracker.GetRemoteTracker("192.168.20.140");
//irTracker.Start();
//irTracker.SetCallBack(this);
}
public void EndTrial() {
//irTracker.Stop();
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ END TRIAL");
output.Close();
}
#region Object Events
/************************************/
/* Object Events */
/************************************/
public void ObjectCreate(string fileName, int ObjectID, Context objContext, Point location, float angle)
{
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"OBJECT_CREATE"+" ~ O"+ObjectID+" ~ [] ~ "+this.GetContext(objContext)+" ~ "+fileName+" ~ ("+location.X+","+location.Y+") ~ "+angle.ToString()+"°");
//output.Close();
}
public void ObjectMove(int ObjectID, int userID, string fileName, Context startContext, Point startLoc, float startAngle, Context endContext, Point endLoc, float endAngle)
{
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"OBJECT_MOVE"+" ~ O"+ObjectID+" ~ ["+userID+"] ~ "+this.GetContext(startContext)+" ~ "+fileName+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+startLoc.X+","+startLoc.Y+") ~ "+startAngle+"° ~ "+this.GetContext(endContext)+" ~ ("+endLoc.X+","+endLoc.Y+") ~ "+endAngle+"°");
//output.Close();
}
public void ObjectThrown(int ObjectID, int userID, string fileName, Context startContext, Point startLoc, float startAngle, Context endContext, Point endLoc, float endAngle)
{
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"OBJECT_THROWN"+" ~ O"+ObjectID+" ~ ["+userID+"] ~ "+this.GetContext(startContext)+" ~ "+fileName+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+startLoc.X+","+startLoc.Y+") ~ "+startAngle+"° ~ "+this.GetContext(endContext)+" ~ ("+endLoc.X+","+endLoc.Y+") ~ "+endAngle+"°");
//output.Close();
}
public void ObjectCatched(int ObjectID, int userID, string fileName, Context Context, Point Loc, float Angle)
{
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"OBJECT_CATCHED"+" ~ O"+ObjectID+" ~ ["+userID+"] ~ "+this.GetContext(Context)+" ~ "+fileName+" ~ ("+irX+","+irY+","+irZ+") ~ ("+Loc.X+","+Loc.Y+") ~ "+Angle+"°");
//output.Close();
}
public void ObjectResize(int ObjectID, int userID, string fileName, Context objContext, Point location, float angle, int startWidth, int startHeight, int endWidth, int endHeight) {
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"OBJECT_RESIZE"+" ~ O"+ObjectID+" ~ ["+userID+"] ~ "+this.GetContext(objContext)+" ~ "+fileName+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+") ~ "+angle+"° ~ - ~ "+startWidth+"X"+startHeight+" ~ "+endWidth+"X"+endHeight);
//output.Close();
}
public void ObjectMoveToBG(int ObjectID, int userID, string fileName, Context objContext, Point location, float angle)
{
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"OBJECT_TO_BACKGROUND"+" ~ O"+ObjectID+" ~ ["+userID+"] ~ "+this.GetContext(objContext)+" ~ "+fileName+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+") ~ "+angle+"°");
//output.Close();
}
public void ObjectEnterTerritory( int ObjectID, int userID, string fileName, int territoryID, Point location, float angle) {
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"OBJECT_ENTER_TERRITORY"+" ~ O"+ObjectID+" ~ ["+userID+"] ~ T"+territoryID+" ~ "+fileName+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+") ~ "+angle+"°");
//output.Close();
}
public void ObjectLeaveTerritory( int ObjectID, int userID, string fileName, int territoryID, Point location, float angle) {
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"OBJECT_LEAVE_TERRITORY"+" ~ O"+ObjectID+" ~ ["+userID+"] ~ T"+territoryID+" ~ "+fileName+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+") ~ "+angle+"°");
//output.Close();
}
public void ObjectSwitchTerritory( int ObjectID, int userID, string fileName, Point location, float angle, int oldterritoryID, int newterritoryID)
{
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"OBJECT_SWITCH_TERRITORY"+" ~ O"+ObjectID+" ~ ["+userID+"] ~ T"+oldterritoryID+" ~ "+fileName+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+") ~ "+angle+"° ~ T"+newterritoryID);
//output.Close();
}
#endregion
#region Selection Events
/************************************/
/* Selection Events */
/************************************/
/// <summary>
///
/// </summary>
/// <param name="fileList">List of files contained in the selection.</param>
/// <param name="objContext">Whether this selection is inside or outside of a territory.</param>
/// <param name="startLoc">Mouse down point that starts the selection bounding box.</param>
/// <param name="endLoc">Mouse up point that ends the selection bounding box.</param>
public void SelectionCreate(int SObjectID, int userID, ArrayList objList, Context objContext, Point startLoc, Point endLoc) {
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList)
{
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_CREATE"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ "+this.GetContext(objContext)+" ~ "+fileListString+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+startLoc.X+","+startLoc.Y+") ~ ("+endLoc.X+","+endLoc.Y+")");
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID"></param>
/// <param name="fileList">List of files contained in the selection.</param>
/// <param name="objContext">Whether this selection is inside or outside of a territory.</param>
/// <param name="startLoc">Mouse down location that starts the selection move event.</param>
/// <param name="startAngle">Beginning angle of the Selection under the pen/cursor. This will serve as an example for the other objects in the selection.</param>
/// <param name="endLoc">Mouse up location that ends the selection move event.</param>
/// <param name="endAngle">End angle of the Selection under the pen/cursor. This will serve as an example for the other objects in the selection.</param>
public void SelectionMove(int SObjectID, int userID, ArrayList objList, Context startContext, Point startLoc, float startAngle, Context endContext, Point endLoc, float endAngle)
{
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList) {
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_MOVE"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ "+this.GetContext(startContext)+" ~ "+fileListString+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+startLoc.X+","+startLoc.Y+") ~ "+startAngle+"° ~ "+this.GetContext(endContext)+" ~ ("+endLoc.X+","+endLoc.Y+") ~ "+endAngle+"°");
//output.Close();
}
public void SelectionThrown(int SObjectID, int userID, ArrayList objList, Context startContext, Point startLoc, float startAngle, Context endContext, Point endLoc, float endAngle)
{
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList)
{
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_TROWN"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ "+this.GetContext(startContext)+" ~ "+fileListString+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+startLoc.X+","+startLoc.Y+") ~ "+startAngle+"° ~ "+this.GetContext(endContext)+" ~ ("+endLoc.X+","+endLoc.Y+") ~ "+endAngle+"°");
//output.Close();
}
public void SelectionCatched(int SObjectID, int userID, ArrayList objList, Context Context, Point Loc, float Angle)
{
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList)
{
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_CATCHED"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ "+this.GetContext(Context)+" ~ "+fileListString+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+Loc.X+","+Loc.Y+") ~ "+Angle+"°");
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID">The user ID.</param>
/// <param name="fileList">List of files contained in the selection.</param>
/// <param name="objContext">Whether this selection is inside or outside of a territory.</param>
/// <param name="location">Location of the mouse up event after the resize</param>
/// <param name="angle">Angle of the specific object that was acted upon for the resizing of the selection.</param>
/// <param name="startWidth">Width at the beginning of the resize event of the object under the pen. This will serve as an example for the other objects that were also resized in the selection.</param>
/// <param name="startHeight">Height at the beginning of the resize event of the object under the pen. This will serve as an example for the other objects that were also resized in the selection.</param>
/// <param name="endWidth">Width at the end of the resize event of the object under the pen. This will serve as an example for the other objects that were also resized in the selection.</param>
/// <param name="endHeight">Height at the end of the resize event of the object under the pen. This will serve as an example for the other objects that were also resized in the selection.</param>
public void SelectionResize(int SObjectID, int userID, ArrayList objList, Context objContext, Point location, float angle, int startWidth, int startHeight, int endWidth, int endHeight) {
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList)
{
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_RESIZE"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ "+this.GetContext(objContext)+" ~ "+fileListString+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+") ~ "+angle+"° ~ - ~ "+startWidth+"X"+startHeight+" ~ "+endWidth+"X"+endHeight);
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID">The user ID.</param>
/// <param name="fileList">List of files contained in the selection.</param>
/// <param name="territoryID">The id of the territory that is being entered.</param>
/// <param name="location">Location of the pen/cursor when the boundary is crossed.</param>
/// <param name="fileList"></param>
public void SelectionEnterTerritory(int SObjectID, int userID, ArrayList objList, int territoryID, Point location, float angle) {
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList)
{
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_ENTER_TERRITORY"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ T"+territoryID+" ~ "+fileListString+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+") ~ "+angle+"°");
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID">The user ID.</param>
/// <param name="fileList">List of files contained in the selection.</param>
/// <param name="territoryID">The id of the territory that is being left.</param>
/// <param name="location">Location of the pen/cursor when the boundary is crossed.</param>
/// <param name="fileList"></param>
public void SelectionLeaveTerritory(int SObjectID, int userID, ArrayList objList, int territoryID, Point location, float angle) {
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList)
{
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_LEAVE_TERRITORY"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ T"+territoryID+" ~ "+fileListString+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+") ~ "+angle+"°");
//output.Close();
}
public void SelectionSwitchTerritory(int SObjectID, int userID, ArrayList objList, Point location, float angle , int oldterritoryID, int newterritoryID)
{
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList)
{
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_SWITCH_TERRITORY"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ T"+oldterritoryID+" ~ "+fileListString+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+") ~ "+angle+"° ~ T"+newterritoryID);
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID">The user ID.</param>
/// <param name="fileList">List of files contained in the selection.</param>
/// <param name="objContext">Whether the selection is inside or outside of a territory.</param>
/// <param name="location">Location of the double touch that removed this selection.</param>
public void SelectionRemove(int SObjectID, int userID, ArrayList objList, Context objContext, Point location) {
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList)
{
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_REMOVE"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ "+this.GetContext(objContext)+" ~ "+fileListString+" ~ IR("+irX+","+irY+","+irZ+") ~ ("+location.X+","+location.Y+")");
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID">The user ID.</param>
/// <param name="fileList">List of files contained in the selection.</param>
/// <param name="objContext">Whether the selection is inside or outside of a territory.</param>
/// <param name="location">Location of the pen/cursor when the boundary is crossed.</param>
public void SelectionUpdate(int SObjectID, int userID, ArrayList objList, Context objContext)
{
// Create an output list of the files in the selection
string fileListString = "( "+objList.Count+": ";
foreach (InterfaceObject obj in objList)
{
fileListString = fileListString + obj.getFileName() + ", ";
}
fileListString += ")";
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_UPDATE"+" ~ S"+SObjectID+" ~ ["+userID+"] ~ "+this.GetContext(objContext)+" ~ "+fileListString);
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID">The user ID.</param>
/// <param name="fileList">List of files contained in the selection.</param>
/// <param name="objContext">Whether the selection is inside or outside of a territory.</param>
public void SelectionEmpty(int SObjectID, int userID, Context objContext)
{
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"SELECTION_EMPTY"+" ~ S"+SObjectID+" ~ ["+userID+"]");
//output.Close();
}
#endregion
#region Storage Territory Events
/************************************/
/* Storage Territory Events */
/************************************/
/// <summary>
///
/// </summary>
/// <param name="territoryID">The territory ID.</param>
/// <param name="territoryType">The type of territory.</param>
/// <param name="location">Initial location of the centre point of the territory.</param>
/// <param name="width">Initial width/radius of the territory (i.e. distance from one of the control points to the territory centre..</param>
public void StorageTerritoryMobileCreate(int territoryID, Point location, int width) {
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"TERRITORY_MOBILE_CREATE"+" ~ T"+territoryID+" ~ [] ~ ("+location.X+","+location.Y+") ~ |"+width+"|");
//output.Close();
}
public void StorageTerritoryFixedCreate(int territoryID, int width)
{
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"TERRITORY_FIXED_CREATE"+" ~ T"+territoryID+" ~ [] ~ |"+width+"|");
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID">The user ID.</param>
/// <param name="territoryID">The territory ID.</param>
/// <param name="startLoc">Start location of the control point that the user is using to move the territory.</param>
/// <param name="endLoc">End location of the control point that the user is using to move the territory.</param>
public void StorageTerritoryMobileMove(int userID, int territoryID, Point startLoc, Point endLoc) {
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"TERRITORY_MOBILE_MOVE"+" ~ T"+territoryID+" ~ ["+userID+"] ~ - ~ - ~ IR("+irX+","+irY+","+irZ+") ~ ("+startLoc.X+","+startLoc.Y+") ~ ("+endLoc.X+","+endLoc.Y+")");
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID">The user ID.</param>
/// <param name="territoryID">The territory ID.</param>
/// <param name="startLoc">Start location of the control point that the user is using to resize the territory.</param>
/// <param name="endLoc">End location of the control point that the user is using to resize the territory.</param>
/// <param name="startWidth">Start width/radius of the territory (i.e. distance from control point to territory centre).</param>
/// <param name="endWidth">End width/radius of the territory (i.e. distance from control point to territory centre).</param>
public void StorageTerritoryMobileResize(int userID, int territoryID, Point startLoc, Point endLoc, int startWidth, int endWidth) {
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"TERRITORY_MOBILE_RESIZE"+" ~ T"+territoryID+" ~ ["+userID+"] ~ - ~ - ~ IR("+irX+","+irY+","+irZ+") ~ ("+startLoc.X+","+startLoc.Y+") ~ ("+endLoc.X+","+endLoc.Y+") ~ |"+startWidth+"| ~ |"+endWidth+"|");
//output.Close();
}
public void StorageTerritoryFixedResize(int userID, int territoryID, Point startLoc, Point endLoc, int startLeftDist, int startTopDist, int startRightDist, int startBottomDist, int endLeftDist, int endTopDist, int endRightDist, int endBottomDist)
{
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"TERRITORY_FIXED_RESIZE"+" ~ T"+territoryID+" ~ ["+userID+"] ~ IR("+irX+","+irY+","+irZ+") ~ - ~ - ~ ("+startLoc.X+","+startLoc.Y+") ~ ("+endLoc.X+","+endLoc.Y+") ~ BorderDistance(L"+startLeftDist+",T"+startTopDist+",R"+startRightDist+",B"+startBottomDist+") ~ BorderDistance(L"+endLeftDist+",T"+endTopDist+",R"+endRightDist+",B"+endBottomDist+")");
//output.Close();
}
/// <summary>
///
/// </summary>
/// <param name="userID">The user ID.</param>
/// <param name="territoryID">The territory ID.</param>
/// <param name="startLoc">Start location of the control point that the user is using to reshape the territory.</param>
/// <param name="endLoc">End location of the control point that the user is using to reshape the territory.</param>
/// <param name="startWidth">Start width/radius of the territory (i.e. distance from control point to territory centre).</param>
/// <param name="endWidth">End width/radius of the territory (i.e. distance from control point to territory centre).</param>
public void StorageTerritoryMobileReshape(int userID, int territoryID, Point startLoc, Point endLoc, int startWidth, int endWidth) {
// Get current location of IR enhanced pen
//irTracker.GetLocation(0,out irX,out irY,out irZ);
// Write to log
//output = new StreamWriter(this.logname, true, System.Text.Encoding.Default);
output.WriteLine(System.DateTime.Now.TimeOfDay+" ~ "+"TERRITORY_MOBILE_RESHAPE"+" ~ T"+territoryID+" ~ ["+userID+"] ~ - ~ - ~ IR("+irX+","+irY+","+irZ+") ~ ("+startLoc.X+","+startLoc.Y+") ~ ("+endLoc.X+","+endLoc.Y+") ~ |"+startWidth+"| ~ |"+endWidth+"|");
//output.Close();
}
#endregion
#region String Conversion methods
private string GetTerritoryType(StartupScreen.StorageType storageType) {
string storageString = "";
switch (storageType) {
case StartupScreen.StorageType.Fixed:
storageString = "Fixed";
break;
case StartupScreen.StorageType.Mobile:
storageString = "Mobile";
break;
}
return storageString;
} // private string GetContext(Context objContext)
private string GetContext(Context objContext) {
string contextString = "";
switch (objContext) {
case Context.InFuzzyBoundary:
contextString = "InFuzzyBoundary";
break;
case Context.InStorageTerritory:
contextString = "InStorageTerritory";
break;
case Context.OutsideTerritory:
contextString = "OutsideTerritory";
break;
}
return contextString;
} // private string GetContext(Context objContext)
#endregion
}
}
See more files for this project here