示例#1
0
 static public void Stop()
 {
     if (Debug)
     {
         LogWindow.Close();
     }
 }
示例#2
0
 private void MainWindow_OnClosing(object sender, CancelEventArgs e)
 {
     try
     {
         _logWindow.Close();
     }
     catch (Exception)
     {
         // ignore
     }
 }
示例#3
0
        // Просмотр событий
        void btnLog_Click(object sender, RoutedEventArgs e)
        {
            if (logWin != null)
            {
                try { logWin.Close(); }
                catch { }
            }

            logWin = new LogWindow(App.Log)
            {
                Owner = this
            };
            logWin.Show();
        }
示例#4
0
        void InfoIconClick(object sender, EventArgs e)
        {
            if (logWin != null)
            {
                try { logWin.Close(); }
                catch { }
            }

            logWin = new LogWindow(log)
            {
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };
            logWin.Show();
        }
示例#5
0
 public void ZamknijLog()
 {
     _logWindow.Close();
 }
示例#6
0
 private void MainWindow_OnClosing(object sender, CancelEventArgs e) => _logWindow?.Close();
示例#7
0
        void currBgw_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker            selfWorker        = sender as BackgroundWorker;
            FileInfo                    finfo             = ((object[])e.Argument)[0] as FileInfo;
            Dictionary <string, object> defaultProperties = ((object[])e.Argument)[1] as Dictionary <string, object>;
            //int currentBgwID = (int) ((object[]) e.Argument)[2];
            LogWindow currImageLogWindow = null;
            bool      showOnlyErrors     = false;

            string sunDiskInfoFileName = finfo.DirectoryName + "\\" +
                                         Path.GetFileNameWithoutExtension(finfo.FullName) + "-SunDiskInfo.xml";

            if (File.Exists(sunDiskInfoFileName))
            {
                showOnlyErrors = true;
            }

            try
            {
                if (finfo == null)
                {
                    e.Result = false;
                    return;
                }

                if (!showOnlyErrors)
                {
                    currImageLogWindow = ServiceTools.LogAText(currImageLogWindow, Environment.NewLine + "starting: " + finfo.Name);
                    currImageLogWindow = ServiceTools.LogAText(currImageLogWindow, "start processing image " + finfo.Name);
                }


                AngleSunDeviationCalcResult devCalcResDatum = CalculateDevDataForImage(finfo, defaultProperties, currImageLogWindow, showOnlyErrors);


                if (devCalcResDatum.calculationSucceeded)
                {
                    cbAnglesSunDeviationCalcResults.Add(devCalcResDatum);
                }


                if (!showOnlyErrors)
                {
                    currImageLogWindow = ServiceTools.LogAText(currImageLogWindow,
                                                               Environment.NewLine + "finished: " + Path.GetFileName(devCalcResDatum.fileName) +
                                                               " with result: " + devCalcResDatum.calculationSucceeded + Environment.NewLine +
                                                               devCalcResDatum.resultMessage);
                }


                if (currImageLogWindow != null)
                {
                    currImageLogWindow.Close();
                }
            }
            catch (Exception ex)
            {
                theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                     Environment.NewLine + "ERROR. There exceptions has been thrown: " + Environment.NewLine + ex.Message);

                string strDirForFailedImages = Path.GetDirectoryName(finfo.FullName);
                strDirForFailedImages += (strDirForFailedImages.Last() == '\\') ? ("") : ("\\") + "failed-detections\\";
                try
                {
                    if (ServiceTools.CheckIfDirectoryExists(strDirForFailedImages))
                    {
                        File.Move(finfo.FullName, strDirForFailedImages + finfo.Name);
                    }
                }
                catch (Exception ex1)
                {
                    theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                         Environment.NewLine + "ERROR. There exceptions has been thrown: " + Environment.NewLine +
                                                         ex1.Message);
                }


                if (currImageLogWindow != null)
                {
                    currImageLogWindow.Close();
                }
            }


            e.Result = new object[] { true };
        }