Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParamPrompt"/> class.
        /// </summary>
        /// <param name="DisplayParamsOfObject">The Box for which you want the user to specify or alter the properties for.</param>
		public ParamPrompt(Box DisplayParamsOfObject)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			this.Text = DisplayParamsOfObject.Name + " Options";
            propertyGrid1.PropertySort = PropertySort.Categorized;
			propertyGrid1.SelectedObject = (object)DisplayParamsOfObject;
		
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
Пример #2
0
 public void BlankBox()
 {
     Box b = new Box();
     Assert.That(!b.Off);
     Assert.That(b.QuickOrder);
     Assert.That(b.Turns == 0);
     Assert.That(!b.TradeCaps);
     Assert.That(!b.Debug);
     Assert.That(b.DayStart == 930);
     // this box doesn't do anything, so it returns a blank/invalid order
     // for every tick that it trades
     for (int i = 0; i < timesales.Length; i++)
         Assert.That(!b.Trade(timesales[i], new BarList(), new Position(s), new BoxInfo()).isValid);
     // no debugs were sent
     Assert.That(debugs == 0);
     
 }
Пример #3
0
        void loadboxname(string name)
        {
            try
            {
                mybox = Box.FromDLL(name, boxdll);
            }
            catch (Exception ex) { debug(ex.Message); debug("Error, quitting..."); return; }
            if ((mybox != null) && (mybox.FullName == name))
            {
                mybox.Debug = boxdebugs;
                mybox.GotDebug += new DebugFullDelegate(mybox_GotDebug);
                mybox.CancelOrderSource += new UIntDelegate(mybox_CancelOrderSource);
                broker.GotOrder+=new OrderDelegate(mybox.gotOrderSink);
                broker.GotOrderCancel += new Broker.OrderCancelDelegate(broker_GotOrderCancel);
                status(boxname + " is current box.");
            }
            else status("Box did not load.");

        }
Пример #4
0
 private void Boxes_SelectedIndexChanged(object sender, EventArgs e)
 {
     string boxname = (string)Boxes.SelectedItem;
     workingbox = Box.FromDLL(boxname, boxdll);
     workingbox.Debug = debugon.Checked;
     workingbox.GotDebug += new DebugFullDelegate(workingbox_GotDebug);
     workingbox.CancelOrderSource += new UIntDelegate(workingbox_CancelOrderSource);
     tl.gotOrder+=new OrderDelegate(workingbox.gotOrderSink);
     tl.gotOrderCancel+=new UIntDelegate(workingbox.gotCancelSink);
 }
Пример #5
0
 public bool Box(string boxname)
 {
     Assembly a;
     Type type;
     object[] args;
     try
     {
         a = Assembly.LoadFrom(aname);
     }
     catch (Exception ex) { show(ex.Message+Environment.NewLine); return false; }
     try
     {
         type = a.GetType(boxname,true,true);
     }
     catch (Exception ex) { show(ex.Message+Environment.NewLine); return false; }
     this.myboxtype = type;
     args = new object[] {};
     try
     {
         mybox = (Box)Activator.CreateInstance(myboxtype,args);
     }
     catch (Exception ex) { show(ex.Message+Environment.NewLine); return false; }
     mybox.FullName = boxname;
     mybox.Debug = debug;
     return true;
 }
Пример #6
0
 private void boxlist_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         mybox = Box.FromDLL((string)boxlist.SelectedItem, WinGauntlet.Properties.Settings.Default.boxdll);
     }
     catch (Exception ex) { show("Box failed to load, quitting... (" + ex.Message + (ex.InnerException != null ? ex.InnerException.Message.ToString() : "") + ")"); }
     mybox.IndicatorUpdate += new ObjectArrayDelegate(mybox_IndicatorUpdate);
     mybox.GotDebug += new DebugFullDelegate(mybox_GotDebug);
     mybox.CancelOrderSource += new UIntDelegate(mybox_CancelOrderSource);
 }
Пример #7
0
 /// <summary>
 /// Create a box from an Assembly containing Box classes.
 /// </summary>
 /// <param name="a">the assembly.</param>
 /// <param name="boxname">The fully-qualified boxname.</param>
 /// <param name="ns">The NewsService where this box will send debugs and errors.</param>
 /// <returns></returns>
 public static Box FromAssembly(System.Reflection.Assembly a, string boxname)
 {
     Type type;
     object[] args;
     Box b = new Box();
     try
     {
         type = a.GetType(boxname, true, true);
     }
     catch (Exception ex) { b = new Box(); b.Name = ex.Message; return b; }
     args = new object[] { };
     try
     {
         b = (Box)Activator.CreateInstance(type, args);
     }
     catch (Exception ex) 
     {
         b = new Box(); b.Name = ex.InnerException.Message; return b;
     }
     b.FullName = boxname;
     return b;
 }
Пример #8
0
 /// <summary>
 /// Create a box from a DLL containing Box classes.  
 /// </summary>
 /// <param name="boxname">The fully-qualified boxname (as in Box.FullName).</param>
 /// <param name="dllname">The dllname.</param>
 /// <param name="ns">The NewsService this box will use.</param>
 /// <returns></returns>
 public static Box FromDLL(string boxname, string dllname)
 {
     System.Reflection.Assembly a;
     try
     {
         a = System.Reflection.Assembly.LoadFrom(dllname);
     }
     catch (Exception ex) { Box b = new Box(); b.Name = ex.Message; return b; }
     return FromAssembly(a, boxname);
 }