コード例 #1
0
        /// <summary>
        /// GUI constructor to have both of the paths as members and log as well as drop file player, audit trail player.
        /// </summary>
        public AmbreRecoveryViewer()
        {
            InitializeComponent();
            typeof(MarketTTAPI).ToString();

            // Create log viewer.
            bool isLogViewerVisible = true;

            Log = new LogHub(ApplicationName, AppInfo.GetInstance().LogPath, isLogViewerVisible, LogLevel.ShowAllMessages);

            // Create app service and get useful paths.
            AppServices appAmbreMaintenanceServices = AppServices.GetInstance(ApplicationName, true);

            m_RepositoryDropFilePath = appAmbreMaintenanceServices.Info.DropPath;
            m_AuditTrailFilePath     = appAmbreMaintenanceServices.Info.DropPath;
            if (m_DebugMode)
            {
                m_ReferenceDropFilePath = m_RepositoryDropFilePath.Replace(ApplicationName, ReferenceApplicationName);
            }
            else
            {
                m_ReferenceDropFilePath = m_RepositoryDropFilePath.Replace(string.Format("\\{0}", ApplicationName), "");
            }

            Log.NewEntry(LogLevel.Minor, "The default paths to operate are {0} and {1}.", m_RepositoryDropFilePath, m_ReferenceDropFilePath);
            if (!System.IO.Directory.Exists(m_ReferenceDropFilePath))
            {
                m_ReferenceDropFilePath = m_RepositoryDropFilePath.Replace(ApplicationName, "Ambre");
                Log.NewEntry(LogLevel.Major, "The default path for reference Ambre system does not exist, and the operating path becomes {0}.", m_ReferenceDropFilePath);
                if (!System.IO.Directory.Exists(m_ReferenceDropFilePath))
                {
                    Log.NewEntry(LogLevel.Major, "The changed path still does not exist. and the program can not proceed.");
                    return;
                }
            }

            // Create market tt api service and tt api service.
            m_MarketTTAPIService = new MarketTTAPI();
            m_MarketTTAPIService.Start();
            m_TTAPIService     = TTApiService.GetInstance();
            m_TTAPIService.Log = this.Log;
            m_TTAPIService.ServiceStateChanged += new EventHandler(TTAPIService_ServiceStateChanged);
            m_TTAPIService.Start();

            // Sample for the user login name and fill hub name.
            textBoxUserName.Text    = "BETSIM";
            textBoxFillHubName.Text = "2014";
            m_UserName = textBoxUserName.Text;
            m_FillHubOrFillManagerName = textBoxFillHubName.Text;

            // Create file players.
            m_DropFilePlayer = new DropFilePlayer(m_ReferenceDropFilePath, Log);

            // Add closing form event trigger.
            this.FormClosing += new FormClosingEventHandler(AmbreRecoveryViewer_Closing);

            // Find all existing audit trail files. Also in this block, toggle the earliest and latest date time to the GUI.
            m_RepoFileList = new List <string>();
            LoadAllAuditTrailFiles();
        }//AmbreRecoveryViewer()
コード例 #2
0
        }//constructor

        //
        //
        private void InitializeServices()
        {
            AppInfo info = AppInfo.GetInstance("Bret");

            bool isLogViewerVisible = false;

            #if (DEBUG)
            isLogViewerVisible = true;
            #endif

            Log = new LogHub("TalkerForm", info.LogPath, isLogViewerVisible, LogLevel.ShowAllMessages);

            // Instantiate TT API.
            m_TTServices = TTServices.TTApiService.GetInstance();
            m_TTServices.ServiceStateChanged += new EventHandler(TTServices_ServiceStateChanged);
            m_TTServices.Start(true);

            // Instantiate hubs
            m_MarketHub = new MarketTTAPI();
            m_MarketHub.Log.IsViewActive = isLogViewerVisible;
            //m_MarketHub.InstrumentChanged += new EventHandler(MarketHub_InstrumentChanged);
            m_MarketHub.Start();

            m_FillHub           = new FillHub(string.Empty, isLogViewerVisible);
            m_FillHub.MarketHub = m_MarketHub;
            //m_FillHub.PositionBookCreated += new EventHandler(FillHub_PositionBookCreated);
            //m_FillHub.PositionBookChanged += new EventHandler(FillHub_PositionBookChanged);
            //m_FillHub.PositionBookPnLChanged += new EventHandler(FillHub_PositionBookPnLChanged);
            m_FillHub.Start();


            m_TalkerHub = new TalkerHub(isLogViewerVisible);
            m_TalkerHub.ServiceStateChanged += new EventHandler(TalkerHub_ServiceStateChanged);
            m_TalkerHub.RequestAddHub(m_FillHub);
            m_TalkerHub.Start();
        }