Ejemplo n.º 1
0
        private void buttonModifyOrder_Click(object sender, EventArgs e)
        {
            List <Order> orders = GetSelectedOrders();

            if (orders.Count > 1 || orders.Count == 0)
            {
                MessageBox.Show("Select a single order to modify.");
                return;
            }

            ActiveOrder selectedOrder = (ActiveOrder)orders[0];

            if (selectedOrder.IsOpenOrPending == false ||
                selectedOrder.OrderExecutionProvider == null)
            //|| selectedOrder.OrderExecutionProvider.DataProvider == null
            //|| selectedOrder.OrderExecutionProvider.DataProvider.Quotes == null)
            {
                return;
            }

            ModifyOrderControl control = new ModifyOrderControl(ModifyOrderControl.ModeEnum.Modify, selectedOrder);

            control.Visible = true;

            HostingForm form = new HostingForm("Modify order", control);

            form.ShowDialog();
        }
        private void toolStripButtonSkipTo_Click(object sender, EventArgs e)
        {
            HostingForm form = new HostingForm("Fast Run", new TimeManagementSkipToControl(_control));

            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.ShowDialog();
        }
Ejemplo n.º 3
0
        private void buttonAddOrder_Click(object sender, EventArgs e)
        {
            if (_selectedSession == null)
            {
                MessageBox.Show("Select a session to send order to.");
                return;
            }

            if (_selectedSession.DataProvider.OperationalState != OperationalStateEnum.Operational ||
                _selectedSession.OrderExecutionProvider.OperationalState != OperationalStateEnum.Operational)
            {
                MessageBox.Show("Session data or order execution provider not operational.");
                return;
            }

            NewOrderControl control = new NewOrderControl(_selectedSession.DataProvider.Quotes, _selectedSession.Info, false, false);

            control.CreatePlaceOrderEvent += new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);

            HostingForm f = new HostingForm("New Order", control);

            f.FormBorderStyle = FormBorderStyle.FixedSingle;
            f.ShowDialog();
            control.CreatePlaceOrderEvent -= new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);
        }
Ejemplo n.º 4
0
 private void toolStripButtonStatistics_Click(object sender, EventArgs e)
 {
     if (_executionAccount != null)
     {
         AccountStatisticsControl control = new AccountStatisticsControl(_executionAccount);
         HostingForm form = new HostingForm("Account Performance Statistics", control);
         form.Show();
     }
 }
        private void fromOnlineSourceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HostingForm form = new HostingForm("Online Sources", new OnlineDataStoresControl()
            {
                Manager = DataStoreComponent.DataStore
            });

            form.Show(this.ParentForm);
        }
Ejemplo n.º 6
0
        private void buttonCloseOrder_Click(object sender, EventArgs e)
        {
            List <Order> orders = GetSelectedOrders();

            if (orders.Count > 1 || orders.Count == 0)
            {
                MessageBox.Show("Select a single order to close.");
                return;
            }

            if (orders[0] is ActiveOrder)
            {
                ActiveOrder order = (ActiveOrder)orders[0];

                if (order.IsOpenOrPending == false)
                {
                    return;
                }

                if (order.State == OrderStateEnum.Submitted)
                {
                    string message;
                    if (order.Cancel(out message))
                    {
                        MessageBox.Show("Order canceled.", "Success", MessageBoxButtons.OK);
                    }
                    else
                    {
                        MessageBox.Show("Order cancel failed [" + message + "].", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    ModifyOrderControl control = new ModifyOrderControl(ModifyOrderControl.ModeEnum.Close, order);
                    HostingForm        form    = new HostingForm("Modify order", control);
                    form.ShowDialog();
                }
            }
            else if (orders[0] is PassiveOrder)
            {
                PassiveOrder order = (PassiveOrder)orders[0];

                if (order.State != OrderStateEnum.Submitted)
                {
                    MessageBox.Show("Passive orders can only be canceled.");
                    return;
                }

                string operationResultMessage = string.Empty;
                if (order.CloseOrCancel(null, null, out operationResultMessage) == false)
                {
                    MessageBox.Show("Failed to cancel order [" + operationResultMessage + "].", "Order Cancel Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Ejemplo n.º 7
0
        public static Form CreateInstance()
        {
            ApplicationRecord appRec = new ApplicationRecord();

            appRec.ApplicationID    = 5;
            appRec.Name             = "WinForm Hello World";
            appRec.Type             = 0;
            appRec.Initialization   = @"
<initstring>
  <assemblyInfo>
    <URL>Microsoft.Ccf.Samples.Citrix.WinFormHelloWorld.dll</URL>
    <type>Microsoft.Ccf.Samples.Citrix.WinFormHelloWorld</type>
  </assemblyInfo>
  <displayGroup>MainPanel</displayGroup>
  <optimumSize x=""470"" y=""380"" />
  <minimumSize x=""340"" y=""180"" />
</initstring>";
            appRec.EnableAutoSignOn = false;
            appRec.LoginFields      = null;

            BindingList <ActionRecord> list = new BindingList <ActionRecord>();

            ActionRecord ar1 = new ActionRecord();

            ar1.ActionID       = 1;
            ar1.Name           = "Default";
            ar1.Initialization = @"<ActionInit/>";
            list.Add(ar1);

            appRec.Actions = list;

#pragma warning disable 0618
            IHostedApplication stub = HostedAppFactory.CreateApplication(appRec);
#pragma warning restore 0618

            HostingForm hostingForm = new HostingForm();
            hostingForm.Name            = "StandAloneTestAppStub";
            hostingForm.Text            = stub.ApplicationName;
            hostingForm.ControlBox      = false;
            hostingForm.MaximizeBox     = false;
            hostingForm.MinimizeBox     = false;
            hostingForm.ShowInTaskbar   = false;
            hostingForm.FormBorderStyle = FormBorderStyle.None;
            hostingForm.StartPosition   = FormStartPosition.Manual;
            hostingForm.ClientSize      = stub.OptimumSize;
            hostingForm.MinimumSize     = stub.MinimumSize;

            hostingForm.Closed += delegate { stub.Close(); };

            stub.TopLevelWindow.Parent = hostingForm;
            stub.TopLevelWindow.Dock   = DockStyle.Fill;

            stub.Initialize();

            return(hostingForm);
        }
Ejemplo n.º 8
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SymbolSelectControl control = new SymbolSelectControl();
            HostingForm         form    = new HostingForm("Select symbol", control);

            control.ShowSelectButton             = true;
            control.Host                         = Component;
            control.SelectedSymbolsChangedEvent += new SymbolSelectControl.SelectedSymbolChangedDelegate(control_SelectedSymbolsChangedEvent);

            form.Show();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 弹出窗口
        /// </summary>
        public void CallNextPatient(string name)
        {
            RtCallMessageFrm rcf = new RtCallMessageFrm(name);
            HostingForm      f   = new HostingForm();

            f.Height        = rcf.Height;
            f.Width         = rcf.Width;
            f.StartPosition = FormStartPosition.CenterScreen;
            f.TopMost       = true;
            f.Controls.Add(rcf);
            f.ShowDialog();
        }
        private void toolStripButtonIndicators_Click(object sender, EventArgs e)
        {
            if (Session == null)
            {
                return;
            }

            ExpertSessionIndicatorsControl control = new ExpertSessionIndicatorsControl(_session, chartControl.Panes);

            control.AddIndicatorEvent    += new ExpertSessionIndicatorsControl.AddIndicatorDelegate(control_AddIndicatorEvent);
            control.RemoveIndicatorEvent += new ExpertSessionIndicatorsControl.RemoveIndicatorDelegate(control_RemoveIndicatorEvent);
            HostingForm form = new HostingForm("Session " + _session.Info.Name + " Indicators", control);

            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.ShowDialog();
        }
Ejemplo n.º 11
0
        private void toolStripButtonNewOrder_Click(object sender, EventArgs e)
        {
            if (_manager == null)
            {
                return;
            }

            Position position = SelectedPosition;

            if (position == null)
            {
                MessageBox.Show("Select a position to put order to.");
                return;
            }

            if (position.DataDelivery.OperationalState != OperationalStateEnum.Operational ||
                position.OrderExecutionProvider.OperationalState != OperationalStateEnum.Operational)
            {
                MessageBox.Show("Position data or order execution provider not operational.");
                return;
            }

            IQuoteProvider  quotes = _manager.ObtainQuoteProvider(position.DataDelivery.SourceId, position.Symbol);
            DataSessionInfo?info   = _manager.GetSymbolDataSessionInfo(position.DataDelivery.SourceId, position.Symbol);

            if (info.HasValue == false)
            {
                MessageBox.Show("Failed to establish position session.", Application.ProductName + " - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            NewOrderControl control = new NewOrderControl(quotes, info.Value, true, true);

            control.CreatePlaceOrderEvent += new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);

            HostingForm f = new HostingForm("New Order", control);

            f.FormBorderStyle = FormBorderStyle.FixedSingle;
            f.MaximizeBox     = false;
            f.ShowDialog();
            control.CreatePlaceOrderEvent -= new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder);
        }
Ejemplo n.º 12
0
        public static Form CreateInstance()
        {
            ApplicationRecord appRec = new ApplicationRecord();

            appRec.ApplicationID    = 7;
            appRec.Name             = "StandaloneTestApp";
            appRec.Type             = 2;
            appRec.Initialization   = @"
<initstring>
    <interopAssembly>
        <URL>C:\CCFCITRIX\Microsoft.Ccf.Samples.StandAloneTestApp.exe</URL>
        <Arguments/>
        <WorkingDirectory>C:\CCFCITRIX</WorkingDirectory>
        <hostInside />
    </interopAssembly>
    <adapter>
        <URL>C:\CCFCITRIX\Microsoft.Ccf.Samples.Citrix.ApplicationAdapter.dll</URL>
        <type>Microsoft.Ccf.Samples.Citrix.AppAdapter</type>
    </adapter>
    <displayGroup>None</displayGroup>
    <optimumSize x=""800"" y=""600"" />
    <minimumSize x=""640"" y=""480"" />
</initstring>";
            appRec.EnableAutoSignOn = false;
            appRec.LoginFields      = null;

            BindingList <ActionRecord> list = new BindingList <ActionRecord>();

            ActionRecord ar1 = new ActionRecord();

            ar1.ActionID       = 1;
            ar1.Name           = "Default";
            ar1.Initialization = @"<ActionInit/>";
            list.Add(ar1);

            ActionRecord ar2 = new ActionRecord();

            ar2.ActionID       = 2;
            ar2.Name           = "PushButton";
            ar2.Initialization = @"
<ActionInit><Steps>
	<GetControlByText>Tab Page 2</GetControlByText>
	<Push/>
	<GetControlByText>Test Checkbox</GetControlByText>
	<Push/>
	<GetControlByText>Radio1</GetControlByText>
	<SetCheck>1</SetCheck>
	<GetControlByPosition x=""88"" y=""48""/>
	<GetText>StandaloneText</GetText>
	<SetText>StandaloneText</SetText>
	<GetControlByText>&amp;Ok</GetControlByText>
	<GetText>ButtonName</GetText>
	<Push/>
</Steps></ActionInit>";
            list.Add(ar2);

            appRec.Actions = list;

            StandAloneStub stub = new StandAloneStub(appRec.ApplicationID, appRec.Name, appRec.Initialization);

            for (int i = 0; i < appRec.Actions.Count; i++)
            {
                stub.AddAction(appRec.Actions[i].ActionID, appRec.Actions[i].Name, appRec.Actions[i].Initialization);
            }

            HostingForm hostingForm = new HostingForm();

            hostingForm.Name            = "StandAloneTestAppStub";
            hostingForm.Text            = stub.ApplicationName;
            hostingForm.ControlBox      = false;
            hostingForm.MaximizeBox     = false;
            hostingForm.MinimizeBox     = false;
            hostingForm.ShowInTaskbar   = false;
            hostingForm.FormBorderStyle = FormBorderStyle.None;
            hostingForm.StartPosition   = FormStartPosition.Manual;
            hostingForm.ClientSize      = stub.OptimumSize;
            hostingForm.MinimumSize     = stub.MinimumSize;

            hostingForm.Closed += delegate { stub.Close(); };

            stub.TopLevelWindow.Parent = hostingForm;
            stub.TopLevelWindow.Dock   = DockStyle.Fill;

            stub.Initialize();

            return(hostingForm);
        }
        void createItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;
            Type componentType     = (Type)item.Tag;

            PlatformComponent component = null;

            bool showPropertiesForm = ComponentManagementAttribute.GetTypeAttribute(componentType).RequestPreStartSetup;

            if (ComponentManagementAttribute.GetTypeAttribute(componentType).IsMandatory)
            {// Mandatory components we do not create, only show / hide.
                component = _platform.GetFirstComponentByType(componentType);
                component.UISerializationInfo.AddValue("componentVisible", true);

                platform_ActiveComponentAddedEvent(component, false);
                return;
            }

            if (componentType.IsSubclassOf(typeof(Expert)))
            {
                component          = new LocalExpertHost(UserFriendlyNameAttribute.GetTypeAttributeName(componentType), componentType);
                showPropertiesForm = showPropertiesForm || ComponentManagementAttribute.GetTypeAttribute(typeof(LocalExpertHost)).RequestPreStartSetup;
            }
            else if (componentType.IsSubclassOf(typeof(WizardControl)))
            {// Wizards are run in Hosting forms.
                ConstructorInfo info = componentType.GetConstructor(new Type[] { typeof(Platform) });

                if (info != null)
                {
                    WizardControl wizardControl = (WizardControl)info.Invoke(new object[] { _platform });
                    HostingForm   hostingForm   = new HostingForm(UserFriendlyNameAttribute.GetTypeAttributeName(componentType), wizardControl);
                    hostingForm.Icon = Resources.magic_wand1;
                    hostingForm.Show();
                    return;
                }
            }
            else if (componentType.IsSubclassOf(typeof(CommonBaseControl)))
            {// Tester/editor etc. controls have no components, they are standalone UI components.
                ConstructorInfo info = componentType.GetConstructor(new Type[] { });
                // If failed to find orderInfo, just fall trough to failed to create component (which remains null).
                if (info != null)
                {// Since this is a UI only component, just create and return.
                    CommonBaseControl testerControl = (CommonBaseControl)info.Invoke(new object[] { });
                    /*tabControl.SelectedTab = */ AddComponentControl(testerControl, true);

                    return;
                }
            }
            else
            {
                ConstructorInfo info = componentType.GetConstructor(new Type[] { });
                if (info != null)
                {
                    component = (PlatformComponent)info.Invoke(new object[] { });
                }
            }

            // ...
            if (component == null)
            {
                MessageBox.Show("Failed to create component.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Set settings for component.
            if (component.SetInitialState(_platform.Settings) == false)
            {
                MessageBox.Show("Component failed to initialize from initial state.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            if (showPropertiesForm)
            {
                // Show properties for the user to configure.
                PropertiesForm form = new PropertiesForm("Properties", component);
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            // Register to platform.
            _platform.RegisterComponent(component);
        }
Ejemplo n.º 14
0
		public static Form CreateInstance()
		{
			ApplicationRecord appRec = new ApplicationRecord();
			appRec.ApplicationID = 7;
			appRec.Name = "HatStandaloneTestApp";
			appRec.Type = 2;
			appRec.Initialization = @"
<initstring>
  <interopAssembly>
    <URL>C:\CCFCITRIX\Microsoft.Ccf.Samples.StandAloneTestApp.exe</URL>
    <Arguments/>
    <WorkingDirectory>C:\CCFCITRIX</WorkingDirectory>
    <hostInside />
  </interopAssembly>
  <DataDrivenAdapterBindings>
    <Type>Microsoft.Ccf.HostedApplicationToolkit.DataDrivenAdapter.WinDataDrivenAdapter, Microsoft.Ccf.HostedApplicationToolkit.DataDrivenAdapter</Type>
    <Controls>
     <AccControl name=""textbox_acc"">
      <Path>
       <Next match=""2"">Test:</Next>
       <Next>Test:</Next>
      </Path>
     </AccControl>
     <AccControl name=""button_acc"">
      <Path>
       <Next>Ok</Next>
       <Next>Ok</Next>
      </Path>
     </AccControl>
     <AccControl name=""checkbox_acc"">
      <Path>
       <Next>Test Checkbox</Next>
       <Next>Test Checkbox</Next>
      </Path>
     </AccControl>
     <AccControl name=""radio1_acc"">
      <Path>
       <Next>Radio1</Next>
       <Next>Radio1</Next>
      </Path>
     </AccControl>
     <AccControl name=""radio2_acc"">
      <Path>
       <Next>Radio2</Next>
       <Next>Radio2</Next>
      </Path>
     </AccControl>
     <AccControl name=""radio3_acc"">
      <Path>
       <Next>Radio3</Next>
       <Next>Radio3</Next>
      </Path>
     </AccControl>
     <AccControl name=""tab1_acc"">
      <Path>
       <Next offset=""-1"">Simulate Crash</Next>
       <Next offset=""1"">Application</Next>
       <Next>Tab Page 1</Next>
      </Path>
     </AccControl>
     <AccControl name=""tab2_acc"">
      <Path>
       <Next offset=""-1"">Simulate Crash</Next>
       <Next offset=""1"">Application</Next>
       <Next>Tab Page 2</Next>
      </Path>
     </AccControl>
     <AccControl name=""crashbutton_acc"">
      <Path>
       <Next>Simulate Crash</Next>
       <Next>Simulate Crash</Next>
      </Path>
     </AccControl>
    </Controls>
  </DataDrivenAdapterBindings>
  <displayGroup>None</displayGroup>
  <optimumSize x=""800"" y=""600"" />
  <minimumSize x=""640"" y=""480"" />
</initstring>";
			appRec.EnableAutoSignOn = false;
			appRec.LoginFields = null;

			BindingList<ActionRecord> list = new BindingList<ActionRecord>();

			ActionRecord ar1 = new ActionRecord();
			ar1.ActionID = 1;
			ar1.Name = "Default";
			ar1.Initialization = @"<ActionInit/>";
			list.Add(ar1);

			appRec.Actions = list;

			HatStandAloneStub stub = new HatStandAloneStub(appRec.ApplicationID, appRec.Name, appRec.Initialization);
			for (int i = 0; i < appRec.Actions.Count; i++)
			{
				stub.AddAction(appRec.Actions[i].ActionID, appRec.Actions[i].Name, appRec.Actions[i].Initialization);
			}

			HostingForm hostingForm = new HostingForm();
			hostingForm.Name = "HatStandAloneTestAppStub";
			hostingForm.Text = stub.ApplicationName;
			hostingForm.ControlBox = false;
			hostingForm.MaximizeBox = false;
			hostingForm.MinimizeBox = false;
			hostingForm.ShowInTaskbar = false;
			hostingForm.FormBorderStyle = FormBorderStyle.None;
			hostingForm.StartPosition = FormStartPosition.Manual;
			hostingForm.ClientSize = stub.OptimumSize;
			hostingForm.MinimumSize = stub.MinimumSize;

			hostingForm.Closed += delegate { stub.Close(); };

			stub.TopLevelWindow.Parent = hostingForm;
			stub.TopLevelWindow.Dock = DockStyle.Fill;

			stub.Initialize();

			return hostingForm;
		}