Пример #1
0
 public void Test()
 {
     using (NDC.Push("test2"))
     {
         log.Info("return");
         Thread.Sleep(100);
     }
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tilesColors"></param>
        /// <param name="avgsMaster"></param>
        /// <param name="tX"></param>
        /// <param name="tY"></param>
        /// <returns></returns>
        protected List <string>[,] MatchTilesToColor(Dictionary <string, Color> tilesColors, Color[,] avgsMaster, int tX, int tY)
        {
            using (NDC.Push(MethodBase.GetCurrentMethod().Name))
            {
                var searchCounter = 1;
                List <string>[,] matchedColors = new List <string> [tX, tY];

                Parallel.For(0, tX, x =>
                {
                    Parallel.For(0, tY, (y) =>
                    {
                        log.DebugFormat("Color buffer set to {0}", buffer);

                        int i = 0;
                        //maximum = tX * tY + 1;
                        //var percentage = (int)((searchCounter / maximum) * 100);
                        //worker.ReportProgress(percentage, strings.CalculateMosaic);

                        var colors = new List <string>();

                        while (tilesColors.Count - 1 >= i)
                        {
                            log.DebugFormat("Searchcounter: {0}, index: {1}", searchCounter, i);
                            string name = "tiles\\" + i.ToString() + ".bmp";
                            log.DebugFormat("Tile name {0}", name);
                            try
                            {
                                if (Utils.GetDifference(avgsMaster[x, y], tilesColors[name]) < buffer)
                                {
                                    colors.Add(name);
                                    log.InfoFormat("added for x={0} y={1} filename: {2}", x, y, name);
                                }
                                else
                                {
                                    // in case of buffer is not enough
                                }
                            }
                            catch (Exception ex)
                            {
                                log.ErrorFormat("Name of tile during error {0}", name);
                                log.Error(ex.Message, ex);
                            }
                            i++;
                            if (tilesColors.Count == i && colors.Count < this.tilesInGroup)
                            {
                                i       = 0;
                                buffer += 25;
                                log.InfoFormat("buffer set to {0}", buffer);
                            }
                        }
                        matchedColors[x, y] = colors;
                        searchCounter++;
                    });
                });

                return(matchedColors);
            }
        }
Пример #3
0
        public override Image CalculateColors(string fileName, out Color[,] colorsArray)
        {
            using (NDC.Push(MethodBase.GetCurrentMethod().Name)) {
                var image  = Image.FromFile(fileName);
                var height = this.height;
                var width  = this.width;
                log.InfoFormat("Images size of {0}x{1}", width, height);
                var     tileSize     = new Size((int)width, (int)height);
                Boolean bitmapLoaded = false;
                Bitmap  masterBitMap = null;

                log.Info("Averaging colors");

                while (!bitmapLoaded)
                {
                    try {
                        masterBitMap = new Bitmap((Image)image.Clone());
                        log.InfoFormat("Main image set");
                        bitmapLoaded = true;
                    } catch (OutOfMemoryException ex) {
                        log.Error(ex.Message, ex);
                        GC.WaitForPendingFinalizers();
                    }
                }

                int tX = masterBitMap.Width / tileSize.Width;
                int tY = masterBitMap.Height / tileSize.Height;
                averageColorsOfMasterImage = new Color[tX, tY];


                var maximum = tX * tY;

                try {
                    lock (image) {
                        for (int x = 0; x < tX; x++)
                        {
                            for (int y = 0; y < tY; y++)
                            {
                                averageColorsOfMasterImage[x, y] = Utils.GetTileAverage(masterBitMap, x * tileSize.Width, y * tileSize.Height, tileSize.Width, tileSize.Height);
                                Rectangle r = new Rectangle(tileSize.Width * x, tileSize.Height * y, tileSize.Width, tileSize.Height);

                                using (Graphics g = Graphics.FromImage(image)) {
                                    g.FillRectangle(new SolidBrush(averageColorsOfMasterImage[x, y]), r);
                                    OnColorCalculated(averageColorsOfMasterImage[x, y], x, y, tX, tY);
                                }
                            }
                            ;
                        }
                        ;
                    }
                } catch (Exception ex) {
                    log.FatalFormat("Fatal error during putting images into big image");
                    log.Fatal(ex.Message, ex);
                }
                colorsArray = averageColorsOfMasterImage;
                return(image);
            }
        }
Пример #4
0
            private void ClientDisconnected(object sender, EventArgs e)
            {
                var channel = (IClientChannel)sender;

                using (NDC.Push(channel.SessionId))
                {
                    Log.Info($"A client disconnected (session: {channel.SessionId}).");
                }
            }
Пример #5
0
            public void Initialize(IClientChannel channel)
            {
                using (NDC.Push(channel.SessionId))
                {
                    Log.Info($"A client connected (session: {channel.SessionId}).");
                }

                channel.Closed  += ClientDisconnected;
                channel.Faulted += ClientDisconnected;
            }
Пример #6
0
 private void CalculateColorsProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     using (NDC.Push(MethodBase.GetCurrentMethod().Name)) {
         var progres = e.ProgressPercentage;
         var v       = e.UserState as String;
         this.pgbOperation.Value = progres;
         this.lblPercentage.Text = string.Format("{0}%", progres);
         this.lblOperation.Text  = v;
     }
 }
Пример #7
0
            public DisposableScope(ILog logger, string s)
            {
                _logger = logger;

                NDC.Push(s);

                if (_logger.Logger.IsEnabledFor(Level.Info))
                {
                    _logger.InfoFormat("BeginScope={0}", s);
                }
            }
Пример #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="source"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public static int GetDifference(Color source, Color target)
 {
     using (NDC.Push(MethodBase.GetCurrentMethod().Name))
     {
         int dR   = Math.Abs(source.R - target.R);
         int dG   = Math.Abs(source.G - target.G);
         int dB   = Math.Abs(source.B - target.B);
         int diff = Math.Max(dR, dG);
         diff = Math.Max(diff, dB);
         return(diff);
     }
 }
Пример #9
0
 public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
 {
     //NDC.Push(channel.SessionId);
     using (NDC.Push(channel.SessionId))
     {
         var context = OperationContext.Current;
         var user    = context?.ServiceSecurityContext?.WindowsIdentity.Name;
         var remoteEndpointMsgProp = context?.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
         Log.Info($"{remoteEndpointMsgProp?.Address}:{user}:{request.Headers.Action}");
     }
     return(null);
 }
Пример #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="bSource"></param>
 /// <param name="newSize"></param>
 /// <returns></returns>
 public static Bitmap ResizeBitmap(Bitmap bSource, Size newSize)
 {
     using (NDC.Push(MethodBase.GetCurrentMethod().Name))
     {
         Bitmap result = new Bitmap(newSize.Width, newSize.Height);
         using (Graphics g = Graphics.FromImage(result))
         {
             g.DrawImage(bSource, 0, 0, newSize.Width, newSize.Height);
         }
         return(result);
     }
 }
Пример #11
0
 /// <summary>
 /// Set values to 0 for all settings
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CalculateColorsCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     using (NDC.Push(MethodBase.GetCurrentMethod().Name)) {
         pgbOperation.Value      = 0;
         this.lblPercentage.Text = "0%";
         lblOperation.Text       = strings.ColorsCalculated;
         this.AverageImage       = e.Result as Image;
         this.orginalImage       = e.Result as Image;
         this.pictureBox.Image   = this.AverageImage;
         this.pictureBox.Refresh();
         this.btnGo.Enabled = true;
     }
 }
Пример #12
0
        public void Test()
        {
            using (NDC.Push("test1"))
            {
                log.Info("feature");
                Thread.Sleep(100);

                Dal d = new Dal();
                d.Test();
                log.Info("return");
                Thread.Sleep(100);
            }
        }
Пример #13
0
        public void Test()
        {
            using (NDC.Push("test1"))
            {
                log.Info("feature");
                System.Threading.Thread.Sleep(100);

                log4net.Tests.Appender.Remoting.Data.Dal d = new log4net.Tests.Appender.Remoting.Data.Dal();
                d.Test();
                log.Info("return");
                System.Threading.Thread.Sleep(100);
            }
        }
Пример #14
0
 private string ObterNomePathNfceXslt()
 {
     using (NDC.Push("ObterNomePathNfceXslt"))
     {
         string xsltpath = String.Empty;
         string assembly = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
         if (assembly != null)
         {
             // xsltpath = assembly.ToLower().Replace("\\bin\\debug", "\\nfce");
             xsltpath = BmsSoftware.ConfigSistema1.Default.PathInstall;
         }
         return(xsltpath);
     }
 }
Пример #15
0
 /// <summary>
 /// Creates empty direcory. When directory already exists
 /// this method removes it and creates new one.
 /// </summary>
 /// <param name="path">string path of the directory. IE: "tiles\\"</param>
 public static void CreateEmptyDirectory(string path)
 {
     log.InfoFormat("{0} path passed as param", path);
     using (NDC.Push(MethodBase.GetCurrentMethod().Name))
     {
         if (Directory.Exists(Path.Combine(path)))
         {
             log.InfoFormat("Direcory tiles exists");
             Directory.Delete(Path.Combine(path), true);
             log.InfoFormat("Direcory tiles removed");
         }
         Directory.CreateDirectory(path);
     }
 }
Пример #16
0
        public void Emit(LogEvent logEvent)
        {
            var loggerName = this.defaultLoggerName;

            if (logEvent.Properties.TryGetValue(Constants.SourceContextPropertyName, out var sourceContext))
            {
                if (sourceContext is ScalarValue sv && sv.Value is string name)
                {
                    loggerName = name;
                }
            }

            var message   = logEvent.RenderMessage(this.formatProvider);
            var exception = logEvent.Exception;

            var logger = LogManager.GetLogger(loggerName);

            using (this.supplyContextMessage ? NDC.Push(ContextMessage) : new NullDisposable())
            {
                switch (logEvent.Level)
                {
                case LogEventLevel.Verbose:
                case LogEventLevel.Debug:
                    logger.Debug(message, exception);
                    break;

                case LogEventLevel.Information:
                    logger.Info(message, exception);
                    break;

                case LogEventLevel.Warning:
                    logger.Warn(message, exception);
                    break;

                case LogEventLevel.Error:
                    logger.Error(message, exception);
                    break;

                case LogEventLevel.Fatal:
                    logger.Fatal(message, exception);
                    break;

                default:
                    SelfLog.WriteLine("Unexpected logging level, writing to log4net as Info");
                    logger.Info(message, exception);
                    break;
                }
            }
        }
Пример #17
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure();

            Console.WriteLine("Press any key to start ...");
            Console.ReadKey(true);

            var cts    = new CancellationTokenSource();
            var thread = new Thread(state =>
            {
                var token  = (CancellationToken)state;
                var logger = LogManager.GetLogger(typeof(Program));
                try
                {
                    while (true)
                    {
                        token.ThrowIfCancellationRequested();
                        using (CorrelationScope.New())
                        {
                            using (NDC.Push("verbose messages"))
                            {
                                logger.Debug("debug message.");
                                logger.Info("info message.");
                            }
                            using (NDC.Push("notification messages"))
                            {
                                logger.Warn("warn message.");
                                logger.Error("error message.", new NotSupportedException("ELK TEST!"));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    logger.Fatal("fatal message.", ex);
                }
            });

            thread.Start(cts.Token);

            Console.WriteLine("Press any key to stop ...");
            Console.ReadKey(true);

            cts.Cancel();
            thread.Join();

            Console.WriteLine("Press any key to exit ...");
            Console.ReadKey(true);
        }
Пример #18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fileName"></param>
 private void RunBackgroundWorkerForCalculateColorsOfMosaic(string fileName)
 {
     using (NDC.Push(MethodBase.GetCurrentMethod().Name)) {
         Color[,] averageColors;
         int w, h;
         w = (int)nudWidth.Value;
         h = (int)nudHeight.Value;
         ACalculateColors mosaicColors = new ColorCalculation(w, h);
         mosaicColors.ColorCalculated += mosaicColors_ColorCalculated;
         this.AverageImage             = mosaicColors.CalculateColors(fileName, out averageColors);
         this.pictureBox.Image         = AverageImage;
         Ctx.AverageColors             = averageColors;
         this.ActualizeProgressBar("", 0, 1);
     }
 }
Пример #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnRemove_Click(object sender, EventArgs e)
 {
     using (NDC.Push(MethodBase.GetCurrentMethod().Name)) {
         //List<String> fNS = new List<String>();
         //for (int i = 0; i < lbxTiles.Items.Count; i++)
         //{
         //    if (!(lbxTiles.SelectedIndices.Contains(i)))
         //    {
         //        fNS.Add((String)lbxTiles.Items[i]);
         //    }
         //}
         //lbxTiles.Items.Clear();
         //lbxTiles.Items.AddRange(fNS.ToArray());
     }
 }
Пример #20
0
        private void ThreadProc(object info)
        {
            int instance = Interlocked.Increment(ref m_instance);

            using (NDC.Push(instance.ToString()))
            {
                int count = (int)info;

                for (int i = 1; i <= count; i++)
                {
                    log.DebugFormat("{0} message {1} of {2}", m_Name, i, count);
                    Thread.Sleep(500);
                }
            }
        }
Пример #21
0
        /// <summary>
        /// The entry point for the interop test coordinator. This client accepts the following command line arguments:
        /// </summary>
        ///
        /// <p/><table>
        /// <tr><td> -b         <td> The broker URL.       <td> Optional.
        /// <tr><td> -h         <td> The virtual host.     <td> Optional.
        /// <tr><td> -n         <td> The test client name. <td> Optional.
        /// <tr><td> name=value <td> Trailing argument define name/value pairs. Added to system properties. <td> Optional.
        /// </table>
        ///
        /// <param name="args"> The command line arguments. </param>
        public static void Main(string[] args)
        {
            // Extract the command line options (Not exactly Posix but it will do for now...).
            string brokerUrl   = DEFAULT_BROKER_URL;
            string virtualHost = DEFAULT_VIRTUAL_HOST;
            string clientName  = DEFAULT_CLIENT_NAME;

            foreach (string nextArg in args)
            {
                if (nextArg.StartsWith("-b"))
                {
                    brokerUrl = nextArg.Substring(2);
                }
                else if (nextArg.StartsWith("-h"))
                {
                    virtualHost = nextArg.Substring(2);
                }
                else if (nextArg.StartsWith("-n"))
                {
                    clientName = nextArg.Substring(2);
                }
            }

            NDC.Push(clientName);

            // Create a test client and start it running.
            TestClient client = new TestClient(brokerUrl, virtualHost, clientName);

            try
            {
                client.Start();
            }
            catch (Exception e)
            {
                log.Error("The test client was unable to start.", e);
                System.Environment.Exit(1);
            }

            // Wait for a signal on the termination monitor before quitting.
            lock (terminationMonitor)
            {
                Monitor.Wait(terminationMonitor);
            }

            NDC.Pop();
        }
Пример #22
0
        /// <summary>
        /// Run the rules without storing the results in the database
        /// </summary>
        public async Task <bool> Test(string connectionString, string collectionId)
        {
            try
            {
                var actionBlock = new ActionBlock <Rule>(r => TestRule(r, connectionString, collectionId),
                                                         new ExecutionDataflowBlockOptions
                {
                    BoundedCapacity        = 5,
                    MaxDegreeOfParallelism = 5
                });

                var bufferBlock = new BufferBlock <Rule>();

                bufferBlock.LinkTo(actionBlock);

                try
                {
                    foreach (var rule in _model.GetRules(collectionId))
                    {
                        using (NDC.Push(rule.RuleId))
                        {
                            Log.Info("test pending");
                            Log.Debug(rule.Sql);
                        }
                        bufferBlock.Post(rule);
                    }
                    bufferBlock.Complete();
                    await actionBlock.Completion;
                }
                catch (AggregateException ex)
                {
                    foreach (var innerException in ex.InnerExceptions)
                    {
                        Log.Fatal(ex);
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.Fatal(ex);
                return(false);
            }
            return(true);
        }
Пример #23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void calculateMosaicBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            using (NDC.Push(MethodBase.GetCurrentMethod().Name)) {
                var image = e.Result as Image;
                this.orginalImage     = e.Result as Image;
                this.pictureBox.Image = image;
                this.pictureBox.Refresh();
                this.pgbOperation.Value        = 0;
                this.lblOperation.Text         = strings.Finished;
                this.lblPercentage.Text        = "0%";
                this.btnGo.Enabled             = true;
                this.btCancelCalculate.Visible = false;

                if (this.cbOpacity.Checked)
                {
                    this.trackBar_ValueChanged(this.trackBar, new EventArgs());
                }
            }
        }
Пример #24
0
        public void SyntaxError(
            IRecognizer recognizer,
            IToken offendingSymbol,
            int line,
            int charPositionInLine,
            string msg,
            RecognitionException e)
        {
            var file = _fileContextFunc();

            using (NDC.Push($"{line}:{charPositionInLine}"))
            {
                // _log.Error(msg);

                var ruleset = offendingSymbol.InputStream.ToString();
                ruleset = ruleset.Substring(0, ruleset.IndexOf("\r\n", StringComparison.Ordinal));
                _log.Error($"SYNTAX ERROR AT {ruleset} - line {line} column {charPositionInLine}");
            }
        }
        protected void LogDownloadedPrice(ulong sourceTypeId, string archFileName, string extrFileName)
        {
            With.DeadlockWraper((c, t) => {
                var downloadLogId = DownloadLogEntity.Log(sourceTypeId, (uint)CurrPriceItemId,
                                                          null, null,
                                                          DownPriceResultCode.SuccessDownload, archFileName,
                                                          (String.IsNullOrEmpty(extrFileName)) ? null : Path.GetFileName(extrFileName), c);

                var downloadedFileName = Path.Combine(Settings.Default.InboundPath, "d" + CurrPriceItemId + "_" + downloadLogId + GetExt());
                var item = CreatePriceProcessItem(downloadedFileName);
                item.CopyToInbound(extrFileName, c, t);
                CopyToHistory(downloadLogId);
            });

            using (NDC.Push(CurrPriceItemId.ToString()))
                _logger.InfoFormat("Price {0} - {1} скачан/распакован",
                                   drCurrent[SourcesTableColumns.colShortName],
                                   drCurrent[SourcesTableColumns.colPriceName]);
        }
Пример #26
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 protected Dictionary <string, Color> FindAverageColorForTiles(List <string> tilesNames)
 {
     using (NDC.Push(MethodBase.GetCurrentMethod().Name))
     {
         Dictionary <string, Color> tilesColors = new Dictionary <string, Color>();
         foreach (var tilePath in tilesNames)
         {
             try
             {
                 log.DebugFormat("Calculating average color for tile {0}", tilePath);
                 using (Stream stream = new FileStream(tilePath, FileMode.Open))
                 {
                     Bitmap bitmapTile;
                     using (bitmapTile = (Bitmap)Bitmap.FromStream(stream))
                     {
                         tilesColors.Add(tilePath, Utils.GetTileAverage(bitmapTile, 0, 0, this.width, this.height));
                         log.DebugFormat("Color added to collection {0}", tilesColors[tilePath]);
                         OnTileFit(this, new MosaicEventArgs()
                         {
                             TileAverage = tilesColors[tilePath],
                         });
                         //worker.ReportProgress((int)((index / maximum) * 100), String.Format(strings.LoadingAndResizingTiles));
                     }
                     //index++;
                 }
             }
             catch (ArgumentException ex)
             {
                 log.ErrorFormat("{0}: {1}", tilePath, ex.Message);
             }
             catch (OutOfMemoryException ex)
             {
                 log.ErrorFormat("Problem with image {0}", tilePath);
                 log.Error(ex.Message, ex);
                 GC.WaitForPendingFinalizers();
             }
         }
         return(tilesColors);
     }
 }
Пример #27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns>number of collected images</returns>
        internal int CollectImages(string directoryOfImages, int width, int height)
        {
            if (TilesImages == null)
            {
                TilesImages = new HashSet <string>();
            }

            int index = 0;

            using (NDC.Push(MethodBase.GetCurrentMethod().Name))
            {
                string tilesDirectory = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), Properties.Settings.Default.TilesFolder);
                Utils.CreateEmptyDirectory(tilesDirectory);

                if (Directory.Exists(directoryOfImages))
                {
                    log.InfoFormat("Selected directory {0}", directoryOfImages);
                    DirectoryInfo di            = new DirectoryInfo(directoryOfImages);
                    var           directoryInfo = di.GetFiles();
                    var           ofFiles       = directoryInfo.Length;
                    foreach (FileInfo fN in directoryInfo)
                    {
                        bool saved = SaveTileInFolder(fN, tilesDirectory, width, height);
                        if (saved)
                        {
                            if (TileCollected != null)
                            {
                                TileCollected(fN.FullName, fN.Name, index, ofFiles);
                            }
                            index++;
                        }
                    }
                }
                else
                {
                    log.InfoFormat(strings.DirectoryDoesNotExist);
                }
                return(index);
            }
        }
Пример #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bSource"></param>
        /// <param name="targetColor"></param>
        /// <returns></returns>
        public static Bitmap AdjustHue(Bitmap bSource, Color targetColor)
        {
            using (NDC.Push(MethodBase.GetCurrentMethod().Name))
            {
                Bitmap result = new Bitmap(bSource.Width, bSource.Height);
                for (int w = 0; w < bSource.Width; w++)
                {
                    for (int h = 0; h < bSource.Height; h++)
                    {
                        // Get current output color
                        Color clSource = bSource.GetPixel(w, h);
                        int   R        = Math.Min(255, Math.Max(0, ((clSource.R + targetColor.R) / 2)));
                        int   G        = Math.Min(255, Math.Max(0, ((clSource.G + targetColor.G) / 2)));
                        int   B        = Math.Min(255, Math.Max(0, ((clSource.B + targetColor.B) / 2)));
                        Color clAvg    = Color.FromArgb(R, G, B);

                        result.SetPixel(w, h, clAvg);
                    }
                }
                return(result);
            }
        }
Пример #29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (NDC.Push(MethodBase.GetCurrentMethod().Name)) {
                try {
                    SaveFileDialog sfd = new SaveFileDialog();
                    StringBuilder  sb  = new StringBuilder();
                    sb.Append(strings.Bitmap);
                    sb.Append("|*.bmp|");
                    sb.Append(strings.PNGPicture);
                    sb.Append("|*.png|");
                    sb.Append(strings.GIFPicture);
                    sb.Append("|*.gif");

                    sfd.Filter  = sb.ToString();
                    sfd.FileOk += sfd_FileOk;
                    sfd.ShowDialog();
                } catch (Exception ex) {
                    log.Error(ex.Message, ex);
                    MessageBox.Show(ex.Message, strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGo_Click(object sender, EventArgs e)
        {
            using (NDC.Push(MethodBase.GetCurrentMethod().Name)) {
                var settingsForm = new SettingsForm();
                var result       = settingsForm.ShowDialog();
                if (result != System.Windows.Forms.DialogResult.OK)
                {
                    MessageBox.Show(strings.TerminatedByUser, strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    log.InfoFormat("Procedure terminated by user");
                    return;
                }
                switch (Properties.Settings.Default.TilesPlaced)
                {
                case 0:
                    RandomMosaic();
                    break;

                case 1:
                    ClassicMosaic();
                    break;
                }
            }
        }