示例#1
0
        internal static List <TriangleConnectionInfo> GetConnectedTriangles(List <TriangleConnectionInfo> parentConnections, Dictionary <TriangleConnectionInfo, bool> availableConnections, TriangleInfoList triangles, Dictionary <TriangleConnectionInfo, bool> connectedTriangles)
        {
            var foundChildConnections = new List <TriangleConnectionInfo>();

            try
            {
                foreach (var parentConnection in parentConnections)
                {
                    var childConnections = triangles.GetConnectedTriangles(parentConnection);
                    foreach (var childConnection in childConnections)
                    {
                        if (availableConnections.ContainsKey(childConnection))
                        {
                            if (!connectedTriangles.ContainsKey(childConnection))
                            {
                                connectedTriangles.Add(childConnection, false);
                                availableConnections.Remove(childConnection);
                                foundChildConnections.Add(childConnection);
                            }
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                LoggingManager.WriteToLog("Exception Manager", "GetConnectedTriangles", exc.StackTrace);
            }

            return(foundChildConnections);
        }
示例#2
0
    public async void ResetConnection()
    {
#if !UNITY_EDITOR
        DatagramSocket socket = new DatagramSocket();
        socket.MessageReceived += Socket_MessageReceived;

        try
        {
            LoggingManager.Log("Broadcasting over UDP");
            using (var stream = await socket.GetOutputStreamAsync(new HostName("255.255.255.255"), broadcastPort.ToString()))
            {
                using (var writer = new DataWriter(stream))
                {
                    var data = Encoding.ASCII.GetBytes(deviceName);

                    writer.WriteBytes(data);
                    await writer.StoreAsync();
                }
            }
        }
        catch (Exception e)
        {
            LoggingManager.LogError(e.ToString());
            LoggingManager.LogError(SocketError.GetStatus(e.HResult).ToString());
            return;
        }

        LoggingManager.Log("exit start");
#endif
    }
示例#3
0
        /// <summary>
        /// Get file of type with inbuild error messages.
        /// </summary>
        /// <param name="directory">Directory to pick from.</param>
        /// <param name="format">What files to include.</param>
        /// <param name="searchOption">Where to search for files.</param>
        /// <returns>File</returns>
        async Task <string> GetFileOfType(string directory, string format, string defaultName, SearchOption searchOption = SearchOption.TopDirectoryOnly)
        {
            string[] files = Directory.GetFiles(directory, format, searchOption);

            if (files.Length > 1)
            {
                await LoggingManager.LogMessage(LogLevel.Message, $"Using default file name of {defaultName}", "Startup").ConfigureAwait(false);

                for (int i = 0; i < files.Length; i++)
                {
                    string fileName = Path.GetFileNameWithoutExtension(files[i]);

                    if (fileName == defaultName)
                    {
                        return(files[i]);
                    }
                }
            }
            else if (files.Length == 1)
            {
                return(files[0]);
            }
            else if (files.Length == 0)
            {
                return(null);
            }
            else
            {
                await LoggingManager.LogMessage(LogLevel.Message, $"Using default index of {Config.DefaultTokenName}", "Startup").ConfigureAwait(false);
            }

            return(null);
        }
示例#4
0
        /// <summary>
        /// 种植/更新BasicSetting缓存
        /// </summary>
        /// <param name="strCustomerId"></param>
        /// <param name="basicSettingList"></param>
        public void SetBasicSetting(string strCustomerId)
        {
            try
            {
                LoggingSessionInfo _loggingSessionInfo   = new LoggingSessionInfo();
                LoggingManager     CurrentLoggingManager = new LoggingManager();
                var connection = GetCustomerConn(strCustomerId);

                _loggingSessionInfo.ClientID              = strCustomerId;
                CurrentLoggingManager.Connection_String   = connection;
                _loggingSessionInfo.CurrentLoggingManager = CurrentLoggingManager;

                CustomerBasicSettingBLL           bllBasicSetting  = new CustomerBasicSettingBLL(_loggingSessionInfo);
                List <CustomerBasicSettingEntity> listBasicSetting = bllBasicSetting.QueryByEntity(new CustomerBasicSettingEntity()
                {
                    CustomerID = strCustomerId, IsDelete = 0
                }, null).ToList();

                RedisOpenAPI.Instance.CCBasicSetting().SetBasicSetting(new CC_BasicSetting()
                {
                    CustomerId  = strCustomerId,
                    SettingList = listBasicSetting.Select(b => new Setting
                    {
                        SettingCode  = b.SettingCode,
                        SettingDesc  = b.SettingDesc,
                        SettingValue = b.SettingValue
                    }).ToList()
                });
            }
            catch (Exception ex)
            {
                throw new Exception("设置缓存失败!" + ex.Message);
            }
        }
示例#5
0
        /// <summary>
        /// 获取客户的默认角色
        /// </summary>
        /// <param name="loggingManager"></param>
        /// <param name="customer_id"></param>
        /// <returns></returns>
        public RoleModel GetRoleDefaultByCustomerId(LoggingManager loggingManager, string customer_id)
        {
            Hashtable hashTable = new Hashtable();

            hashTable.Add("CustomerId", customer_id);
            return(cSqlMapper.Instance(loggingManager).QueryForObject <RoleModel>("Role.SelectDefaultByCustomerId", hashTable));
        }
        /// <summary>
        /// This is the entry point of the service host process.
        /// </summary>
        private static void Main()
        {
            try
            {
                // The ServiceManifest.XML file defines one or more service type names.
                // Registering a service maps a service type name to a .NET type.
                // When Service Fabric creates an instance of this service type,
                // an instance of the class is created in this host process.

                ServiceRuntime.RegisterServiceAsync("VotingWebType",
                                                    context => {
                    LoggingManager.CreateLogger(context);
                    return(new VotingWeb(context, Log.Logger));
                }).GetAwaiter().GetResult();

                ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(VotingWeb).Name);

                // Prevents this host process from terminating so services keeps running.
                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception e)
            {
                ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
                throw;
            }
        }
示例#7
0
        public static void Deal(string message)
        {
            bool success = MessageManager.ParseStruct <NurseryStruct>(message, out NurseryStruct ns);

            if (success)
            {
                switch (ns.type)
                {
                case NurseryType.Setting:
                    ConfigClerk.Deal(ns.content);
                    break;

                case NurseryType.Operation:
                    OperationClerk.Deal(ns.content);
                    break;

                case NurseryType.Information:
                    InformationClerk.Deal(ns.content);
                    break;

                default:
                    LoggingManager.Warn("Invalid NurseryType");
                    break;
                }
            }
        }
    /// <summary>
    /// remove current screen from stack and show preview screen
    /// </summary>
    public void ShowPreviousScreen()
    {
        //if showing/hiding animation isnt finishd
        if (UIScreenAnimationManager.Instance.isAnimating)
        {
            return;
        }

        if (_screenStack.Count == 0)
        {
            LoggingManager.AddErrorToLog("Try return to preview screen, but screen stack is empty");
            return;
        }
        IUIScreenNavigationController previousScreenNavigationController = _screenStack[_screenStack.Count - 1];

        //remove last screen it must be curren opened screen
        _screenStack.RemoveAt(_screenStack.Count - 1);

        if (_screenStack.Count == 0)
        {
            //go to main screen
            ShowNavigationOfPreviousScreen(_uiScreens[_finishScreen], previousScreenNavigationController.AnimationSettings, null);
        }
        else
        {
            //show preview screen from stack
            ShowNavigationOfPreviousScreen(_uiScreens[_screenStack[_screenStack.Count - 1].ScreenID], previousScreenNavigationController.AnimationSettings, previousScreenNavigationController.Data);
        }
    }
示例#9
0
        internal static void FilterOnLowestOffsetPointsXYEdgePointDistance(ConcurrentDictionary <LowestPointPolygon, Dictionary <float, List <PolyNode> > > facingDownContourItems, float materialSupportConeOverhang)
        {
            //FILTER facingDownContours on offset support points 0.5 * topradius and height += 10
            var minSupportConeDistance = materialSupportConeOverhang;

            foreach (var supportPointContour in facingDownContourItems.Keys)
            {
                foreach (var edgeSupportPointItemPoint in supportPointContour.EdgeIntersectionPoints)
                {
                    foreach (var checkOffsetItem in supportPointContour.LowestPointsWithOffsetIntersectionPoint)
                    {
                        for (var checkFacingDownContourIndex = checkOffsetItem.Value.Count - 1; checkFacingDownContourIndex >= 0; checkFacingDownContourIndex--)
                        {
                            var checkFacingDownContourConnectedChildPoint = checkOffsetItem.Value.ElementAt(checkFacingDownContourIndex);
                            {
                                if (edgeSupportPointItemPoint.Filter == typeOfAutoSupportFilter.None && checkFacingDownContourConnectedChildPoint.Filter == typeOfAutoSupportFilter.None)
                                {
                                    var facingDownVectorDifference = (edgeSupportPointItemPoint.TopPoint.Xy - checkFacingDownContourConnectedChildPoint.TopPoint.Xy).Length;

                                    if (facingDownVectorDifference < minSupportConeDistance)
                                    {
                                        checkFacingDownContourConnectedChildPoint.Filter |= typeOfAutoSupportFilter.FilteredByLowestPointOffsetLowerWithEdgeOverhang;
                                        LoggingManager.WriteToLog("Autosupport Engine", "Filter removed support points distance (edge overhang)", edgeSupportPointItemPoint.ToString());
                                        //break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#10
0
        private void SaveData()
        {
            OleDbCommand oleDbCommand = new OleDbCommand();

            oleDbCommand.Connection = dbUtils.getConnection();
            OleDbTransaction trans = oleDbCommand.Connection.BeginTransaction();

            try
            {
                String sqlQry = "";

                foreach (DataGridViewRow row in dgStockOut.Rows)
                {
                    sqlQry = "UPDATE TRANS SET OUTDATE = #" + String.Format("{0:yyyy/MM/dd}", dtDate.Value) + "# WHERE TID = " + row.Cells[6].Value;
                    oleDbCommand.CommandText = sqlQry;
                    oleDbCommand.Transaction = trans;
                    oleDbCommand.ExecuteNonQuery();
                }
                trans.Commit();
                clearControl();
            }
            catch (Exception ex)
            {
                trans.Rollback();
                MessageBox.Show(ex.Message);
                LoggingManager.WriteToLog(0, "Error : SaveData() : " + ex.Message);
            }
            finally
            {
                oleDbCommand.Connection.Close();
            }
        }
示例#11
0
    public void StartGame()
    {
        if (gameType == GameType.Fitts)
        {
            PrepareFittsGame();
        }
        else if (gameType == GameType.Tunnel)
        {
            PrepareTunnelGame();
        }
        else if (gameType == GameType.Goal)
        {
            PrepareGoalGame();
        }
        else if (gameType == GameType.Custom)
        {
            customGameInstructions.text = "Now logging the Arduino..";
        }

        dateId = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

        if (targetAttributes.Length > 0)
        {
            inGame = true;
            //startButton.Disappear();
            LoggingManager.NewLog();
            startTime = Time.time;
            hitTime   = Time.time;

            currentTarget = 0;
            currentRound  = 0;
            targetNumber  = 0;
        }
    }
示例#12
0
    private IEnumerator CheckOfInitializateAllScreens()
    {
        while (true)
        {
            foreach (IInitilizationProcess pair in _uiScreens.Values)
            {
                if (pair.initializationStatus == EnumInitializationStatus.initializationError)
                {
                    LoggingManager.AddErrorToLog("Problem with " + pair.ClassNameInInitialization);
                    _initializationStatus = EnumInitializationStatus.initializationError;
                    yield break;
                }

                if (!pair.allInitializated)
                {
                    yield return(null);
                }
            }

            if (MainInitializationProcess.Instance.FirstScreen != EnumUIScreenID.withOutName)
            {
                ShowScreenByID(MainInitializationProcess.Instance.FirstScreen);
            }

            _initializationStatus = EnumInitializationStatus.initializated;
            yield break;
        }
        yield break;
    }
示例#13
0
    public void StartInitialization()
    {
        _initializationStatus = EnumInitializationStatus.inProgress;

        //get game obgect by his tag, where must be all ui screens
        GameObject uiScreenContainer = GameObject.FindGameObjectWithTag(TagNames.TAG_UI_SCREEN_CONTAINER);

        if (uiScreenContainer == null)
        {
            LoggingManager.AddErrorToLog("Didn't found game object by tag " + TagNames.TAG_UI_SCREEN_CONTAINER);
            _initializationStatus = EnumInitializationStatus.initializationError;
            return;
        }

        Dictionary <EnumUIScreenID, string> screenList = GetScreenList();

        //add all screens to dictionary by his id
        _uiScreens = new Dictionary <EnumUIScreenID, IUIScreenController>();
        foreach (KeyValuePair <EnumUIScreenID, string> pair in screenList)
        {
            if (!_uiScreens.ContainsKey(pair.Key))
            {
                _uiScreens.Add(pair.Key, PrefabCreatorManager.Instance.InstanceComponent <IUIScreenController>(pair.Value, uiScreenContainer));
                _uiScreens[pair.Key].SetDefaulStartPosition();
            }
            else
            {
                LoggingManager.AddErrorToLog("Found repeat screen id " + pair.Key);
            }
        }

        StartCoroutine(CheckOfInitializateAllScreens());
    }
示例#14
0
        private void MainFrm_Load(object sender, EventArgs e)
        {
            // set position of form
            //base.Location = new Point(800, 150);

            // reader is our handle to the physical reader.
            //reader = new RFIDReader(this);
            handleTags = new WispHandleTags();
            readerMgr = new ReaderManager(this, handleTags);

            log = new WispLoggingManager();
            
            // init the saturn object.
            saturn = new Saturn();

            // Setup axis labels for the various graphs.
            InitSOCGraph();
            InitTempGraph();

            // Other init code
            InitTagStats();

            // Store initial sizes (for resize operation).
            formInitialSize = this.Size;
            pnlTagListInitialSize = pnlTagList.Size;

            // Init GUI operational mode to idle (disconnected)
            SetMode(ReaderManager.GuiModes.Idle);
        }
示例#15
0
        public Session LoginFromSSO(string email, Guid ssoID)
        {
            try
            {
                UserManager um = new UserManager();

                var user = um.GetUser(ssoID);
                if (user == null)
                {
                    user = new User()
                    {
                        SsoId = ssoID,
                        Email = email
                    };

                    um.CreateUser(user);
                }

                SessionManager sessionManager = new SessionManager();
                var            session        = sessionManager.CreateSession(user);
                successLogin++;


                return(session);
            }
            catch (Exception ex)
            {
                var lm = new LoggingManager <ErrorLogDTO>();
                lm.CreateErrorLog(ex);
                failLogin++;
                return(null);
            }
        }
示例#16
0
    void Start()
    {
        LaunchManager launchManager = GameObject.FindGameObjectWithTag("LaunchManager").GetComponent <LaunchManager>();

        log            = launchManager.LoggingManager;
        collectedItems = 0;
    }
        /// <summary>
        /// Handles the Click event of the lnkAddCustomField control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected void lnkAddCustomField_Click(object sender, EventArgs e)
        {
            var newName = txtName.Text.Trim();

            if (newName == String.Empty)
            {
                return;
            }

            var dataType  = (ValidationDataType)Enum.Parse(typeof(ValidationDataType), dropDataType.SelectedValue);
            var fieldType = (CustomFieldType)Enum.Parse(typeof(CustomFieldType), rblCustomFieldType.SelectedValue);
            var required  = chkRequired.Checked;

            var newCustomField = new UserCustomField
            {
                Name      = newName,
                DataType  = dataType,
                Required  = required,
                FieldType = fieldType
            };

            if (UserCustomFieldManager.SaveOrUpdate(newCustomField))
            {
                txtName.Text = "";
                dropDataType.SelectedIndex = 0;
                chkRequired.Checked        = false;
                BindCustomFields();
            }
            else
            {
                lblError.Text = LoggingManager.GetErrorMessageResource("SaveCustomFieldError");
            }
        }
示例#18
0
        public bool Exists(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }
            PortableDevice mtpDevice;

            try
            {
                mtpDevice = MtpDeviceManager.GetPortableDevice(path);
            }
            catch (Exception e)
            {
                LoggingManager.LogSciendoSystemError(e);
                return(false);
            }
            var mtpFile = mtpDevice.GetObject(path.Replace(MtpPathInterpreter.GetMtpDeviceName(path), string.Empty)) as PortableDeviceFile;

            if (mtpFile == null)
            {
                mtpDevice.Disconnect();
                return(false);
            }
            return(true);
        }
示例#19
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            var level    = LoggingManager.LogLevelFromString(ConfigurationManager.AppSettings["LogLevel"]);
            var location = ConfigurationManager.AppSettings["LogLocation"];

#if DEBUG
            LoggingManager.AddLog(new ConsoleLogger(level));
            using (var processor = new LottoProcessorService())
            {
                Console.WriteLine("Starting Lotto Service ...");
                processor.StartService();
                Console.WriteLine("Press Enter to terminate ...");
                Console.ReadLine();
                processor.StopService();
            }
#else
            LoggingManager.AddLog(new FileLogger(location, "LottoService", level));
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new LottoProcessorService()
            };
            ServiceBase.Run(ServicesToRun);
            LoggingManager.Destroy();
#endif
        }
示例#20
0
        public void TestScheduleController()
        {
            var log = new LoggingManager("/dev/null");

            var controller = new ScheduleController(1, log);

            controller.SetSchedule(new[] {
                new ScheduleEntry {
                    StationId   = 1, MinimumBoardingTime = TimeSpan.FromMinutes(2),
                    ArrivalTime = new DateTime(2020, 09, 12, 12, 00, 00), DepartureTime = new DateTime(2020, 09, 12, 12, 02, 00)
                },
                new ScheduleEntry {
                    StationId   = 2, MinimumBoardingTime = TimeSpan.FromMinutes(2),
                    ArrivalTime = new DateTime(2020, 09, 12, 12, 10, 00), DepartureTime = new DateTime(2020, 09, 12, 12, 12, 00)
                },
            });

            var cmd = controller.Update(new DateTime(2020, 09, 12, 12, 00, 00), ScheduleController.Mode.FOLLOW_SCHEDULE,
                                        new WaypointControllerStatus {
                State = WaypointController.State.STOPPED
            });

            Assert.NotNull(cmd);
            Assert.Equal(WaypointController.Mode.GOTO_STATION, cmd.Value.mode);
            Assert.Equal(1, cmd.Value.gotoStationId);
        }
示例#21
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false;
        LaunchManager launchManager = GameObject.FindWithTag("LaunchManager").GetComponent <LaunchManager>();

        log = launchManager.LoggingManager;
        // Get condition and order
        condition = log.GetParameterValue("Condition");
        string order = log.GetParameterValue("Order");

        string filename = "R" + order[blockNumber - 1] + condition + "_recall";

        string[] imageNames = getImageNamesFromFile(filename);

        images = new Sprite[imageNames.Length];
        for (int i = 0; i < imageNames.Length; i++)
        {
            string name = imageNames[i].Split('.')[0];
            images[i] = Resources.Load <Sprite>("screenshots/frontal_perspectives/buildings_route_" + order[blockNumber - 1] + "/" + name);
        }

        if (images.Length > 0)
        {
            images         = randomizeList(new List <Sprite>(images)).ToArray();
            display.sprite = images[imageCounter];
        }

        start = DateTime.Now;
    }
示例#22
0
    public void InitCollaction <T>(string staticFileName) where T : DataVO
    {
        StartInitialization();
        T traceValue;

        LoggingManager.Log(typeof(T) + " Start initialization");
        _collactionName = staticFileName;
        StaticResourcesXmlLoader <T> container = StaticResourcesXmlLoader <T> .LoadContainer(UrlXmls.staticData + staticFileName);

        _collaction     = new Dictionary <string, IStaticData>();
        _listOfAllNames = new List <string>();
        foreach (T data in container.dataList)
        {
            if (!_collaction.ContainsKey(data.Name))
            {
                _collaction.Add(data.Name, data);
                _listOfAllNames.Add(data.Name);
            }
            else
            {
                LoggingManager.AddErrorToLog("Repeated static data element with id " + data.Name);
            }
        }
        LoggingManager.Log(typeof(T) + " Finish initialization");
        _initializationStatus = EnumInitializationStatus.initializated;
    }
示例#23
0
        public override void Startup()
        {
            //(0)应用运行初始配置
            LoggingManager.AddLoggerAdapter(new Log4netLoggerAdapter());  //增加日志组件
            EngineHelper.LoggingInfo("UTH.Meeting.Web - Startup - ");

            //(1)领域相关初始配置
            DomainConfiguration.Initialize();

            //(2)组件安装初始配置
            EngineHelper.Component.List.ForEach(x => x.Install());

            //接口访问处理
            PlugCoreHelper.ApiServerAuthError = (token) =>
            {
                WebHelper.GetContext().Response.Redirect("/account/login");
            };
            PlugCoreHelper.ApiServerAuthExpire = (oldToken, newToken) =>
            {
                if (newToken.IsEmpty())
                {
                    WebHelper.GetContext().Response.Redirect("/account/login");
                }
                else
                {
                    AppHelper.SignIn(newToken);
                }
            };
        }
示例#24
0
        protected void Application_Error(object sender, EventArgs e)
        {
            var            error          = Server.GetLastError();
            LoggingManager loggingManager = new LoggingManager();

            loggingManager.Log.ErrorException("ERROR ", error);
        }
示例#25
0
 // Start is called before the first frame update
 void Awake()
 {
     //numberOfSubjectsTextTemplate = numberOfSubjects.text;
     numberOfSubjectsInfectedTemplate    = numberOfSubjectsInfected.text;
     numberOfSubjectsInIsolationTemplate = numberOfSubjectsInIsolation.text;
     numberOfSubjectsVacTemplate         = numberOfSubjectsVac.text;
     eventLogger = GameObject.Find("Logging").GetComponent <LoggingManager>();
 }
示例#26
0
        protected void Application_Error(object sender, EventArgs e)
        {
            //for unhandled exception
            var exception  = Server.GetLastError();
            var logService = LoggingManager.GetLogInstance();

            logService.LogException("Unhandled Exception From PMS Web", exception);
        }
        public static XElement HandleDate(XElement elt)
        {
            LoggingManager.OutputInfo($"Converting to <date>: {XmlTools.GetNodeLocation(elt)}");
            LoggingManager.OutputVerbose($"Element: {elt}");


            return(new XElement("date", DateTime.Parse(elt.Value).ToString("yyyy-MM-ddT00:00:00")));
        }
        public static void GroupifyTBXElementInSourceXDocument(ref XElement elt)
        {
            XElement grpElt = new XElement(elt.Name + "Grp", new XElement(elt));

            LoggingManager.OutputInfo($"Groupifying {XmlTools.GetNodeLocation(elt)}.");
            LoggingManager.OutputVerbose($"Element: {elt}");
            elt = grpElt;
        }
示例#29
0
    private void ShowGameOverGUI()
    {
        LoggingManager.recordComboCount();
        LoggingManager.recordRewards();
        LoggingManager.endLogging();

        Globals.gameOverGUIScript.Show();
    }
 void Start()
 {
     loggingManager = GameObject.Find("LoggingManager").GetComponent <LoggingManager>();
     urn            = GetComponent <UrnModel>();
     SetupMechanisms();
     SetupUrn();
     LogMeta();
 }
		public void Info_Calls_ILoggingProvider_Level_Info()
		{
			var loggingProviderMock1 = new Mock<ILoggingProvider>();
			var loggingProviderMock2 = new Mock<ILoggingProvider>();
			var loggingManager = new LoggingManager(new[] { loggingProviderMock1.Object, loggingProviderMock2.Object });

			loggingManager.Info(this, "message");

			loggingProviderMock1.Verify(x => x.Log(LogLevel.Info, this, "message"), Times.Exactly(1));
			loggingProviderMock2.Verify(x => x.Log(LogLevel.Info, this, "message"), Times.Exactly(1));
		}
		public void Error_ApplicationException_Calls_ILoggingProvider_LogException_Level_Error()
		{
			var loggingProviderMock1 = new Mock<ILoggingProvider>();
			var loggingProviderMock2 = new Mock<ILoggingProvider>();
			var loggingManager = new LoggingManager(new[] { loggingProviderMock1.Object, loggingProviderMock2.Object });

			var ex = new ApplicationException("error");

			loggingManager.Exception(ex, this, "message");

			loggingProviderMock1.Verify(x => x.LogException(LogLevel.Error, ex, this, "message"), Times.Exactly(1));
			loggingProviderMock2.Verify(x => x.LogException(LogLevel.Error, ex, this, "message"), Times.Exactly(1));
		}
示例#33
0
        public MainWindow()
        {
            InitializeComponent();

            Logger logger = LogManager.GetCurrentClassLogger();
            logger.Trace( "Application Starting..." );

            lm = new LoggingManager();

            anim_manager = new AnimationManager();

            wm  = new WindowManager( RibbonBar, StatusBar, DockWindow, DockingWindowsManager );

            rwm = new RenderWindowManager();

            dsm = new DatasetManager();

            pm  = new PluginManager( this.wm, this.rwm, this.dsm, this.anim_manager );

            pm.loadPluginList( Directory.GetCurrentDirectory() );
        }
		public void Log_FourLoggingProviders_Calls_ILoggingProvider_Log()
		{
			var loggingProviderMock0 = new Mock<ILoggingProvider>();
			var loggingProviderMock1 = new Mock<ILoggingProvider>();
			var loggingProviderMock2 = new Mock<ILoggingProvider>();
			var loggingProviderMock3 = new Mock<ILoggingProvider>();


			var loggingManager = new LoggingManager(new[]
			{
				loggingProviderMock0.Object,
				loggingProviderMock1.Object,
				loggingProviderMock2.Object,
				loggingProviderMock3.Object
			});

			loggingManager.Log(LogLevel.Info, this, "1: {0}, 2: {1}, 3: {2}", 1, 2, 3);

			loggingProviderMock0.Verify(x => x.Log(LogLevel.Info, this, "1: {0}, 2: {1}, 3: {2}", 1, 2, 3), Times.Exactly(1));
			loggingProviderMock1.Verify(x => x.Log(LogLevel.Info, this, "1: {0}, 2: {1}, 3: {2}", 1, 2, 3), Times.Exactly(1));
			loggingProviderMock2.Verify(x => x.Log(LogLevel.Info, this, "1: {0}, 2: {1}, 3: {2}", 1, 2, 3), Times.Exactly(1));
			loggingProviderMock3.Verify(x => x.Log(LogLevel.Info, this, "1: {0}, 2: {1}, 3: {2}", 1, 2, 3), Times.Exactly(1));
		}
		public void LogException_Message_Calls_ILoggingProvider_LogException()
		{
			var loggingProviderMock1 = new Mock<ILoggingProvider>();
			var loggingProviderMock2 = new Mock<ILoggingProvider>();
			var loggingManager = new LoggingManager(new[] { loggingProviderMock1.Object, loggingProviderMock2.Object });

			var ex = new ApplicationException("info");

			loggingManager.LogException(LogLevel.Info, ex, this, "message");

			loggingProviderMock1.Verify(x => x.LogException(LogLevel.Info, ex, this, "message"), Times.Exactly(1));
			loggingProviderMock2.Verify(x => x.LogException(LogLevel.Info, ex, this, "message"), Times.Exactly(1));
		}