예제 #1
0
        public ActionResult Edit(int id, ProgramBase newItem)
        {
            if (ModelState.IsValid & id == newItem.Id)
            {
                // Attempt to update the item
                ProgramBase editedItem = m.EditProgram(newItem);

                if (editedItem == null)
                {
                    // There was a problem updating the object
                    return(View(newItem));
                }
                else
                {
                    //item was edited
                    TempData["statusMessage"] = "Edits have been saved.";
                    return(RedirectToAction("details", new { id = editedItem.Id }));
                }
            }
            else
            {
                // Return the object so the user can edit it correctly
                return(View(newItem));
            }
        }
예제 #2
0
        static void Main()
        {
            ProgramBase.Start(Logging.LOG_MODE.FILE_EXE, true);

            Application.Run(new FormMain());
            ProgramBase.Exit();
        }
예제 #3
0
        private static IHostBuilder CreateHostBuilder(string buildType, string[] args)
        {
            return(ProgramBase.CreateHostBuilderDefaults(buildType, args, configBuilder =>
            {
                configBuilder.SetBasePath(AppContext.BaseDirectory);
                // 不支持动态更换 如果和json内key的重复了也不会动态更新
                configBuilder.AddJsonObject(new
                {
                    AppSettings = new
                    {
                        //AppId = 0,
                        //AppCode = "",
                        //AppName = "",
                        LogOnConsole = 1,
                        Log4netOpen = 1,
                    }
                });

                configBuilder.AddEnvironmentVariables();
            },
                                                         configureServicesDelegate: (context, services) =>
            {
                var configuration = context.Configuration;
                services.AddHostedService <TestBackgroundService>();
                services.Configure <AppSettings>(configuration.GetSection($"{nameof(AppSettings)}"));
                //   LogHelper.RegisterProcessEvent(ConsolePublish);
            }));
        }
        // PUT api/programs/5
        public HttpResponseMessage Put(int id, ProgramBase updatedProgram)
        {
            if (ModelState.IsValid & id == updatedProgram.Id)
            {
                // Update the existing program
                var p = r.UpdateExisting(updatedProgram);

                if (p == null)
                {
                    // If we cannot update the object for some reason
                    // Not sure if this is the best response
                    return(Request.CreateResponse(HttpStatusCode.InternalServerError));
                }
                else
                {
                    // Return the updated object
                    return(Request.CreateResponse <ProgramFull>(HttpStatusCode.OK, p));
                }
            }
            else
            {
                // Not sure if this is the best response
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
예제 #5
0
        static void Main()
        {
            Logging.s_mode = Logging.LOG_MODE.FILE_EXE;

            ProgramBase.Start();

            if (RunOneInstance.ChekRunProgramm("trans_mt"))
            {
                return;
            }

            FormMainTransMT formMain = null;

            try { formMain = new FormMainTransMT(); }
            catch (Exception e)
            {
                Logging.Logg().Exception(e, "!Ошибка! запуска приложения.", Logging.INDEX_MESSAGE.NOT_SET);
            }

            if (!(formMain == null))
            {
                Application.Run(formMain);
            }
            else
            {
                ;
            }

            ProgramBase.Exit();
        }
예제 #6
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     try
     {
         using (OpenFileDialog f = new OpenFileDialog())
         {
             f.FileName         = txtFileName.Text;
             f.AddExtension     = AddExtension;
             f.CheckFileExists  = this.CheckFileExists;
             f.CheckPathExists  = this.CheckPathExists;
             f.Filter           = this.Filter;
             f.RestoreDirectory = false;
             f.DefaultExt       = DefaultExt;
             f.Title            = Title;
             if (f.ShowDialog() == DialogResult.OK)
             {
                 txtFileName.Text = f.FileName;
                 if (FileSelected != null)
                 {
                     FileSelected(this, EventArgs.Empty);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ProgramBase.ShowError(ex);
     }
 }
예제 #7
0
        static void Main()
        {
            Logging.s_mode = Logging.LOG_MODE.FILE_EXE;

            ProgramBase.Start();

            FormMainTransMT formMain = null;

            try { formMain = new FormMainTransMT(); }
            catch (Exception e)
            {
                Logging.Logg().Exception(e, "!Ошибка! запуска приложения.", Logging.INDEX_MESSAGE.NOT_SET);
            }
            try
            {
                if (!(formMain == null))
                {
                    Application.Run(formMain);
                }
                else
                {
                    ;
                }
            }
            catch (Exception e)
            {
                Logging.Logg().Exception(e, "Ошибка выполнения приложения.", Logging.INDEX_MESSAGE.NOT_SET);
            }

            ProgramBase.Exit();
        }
예제 #8
0
        static void Main()
        {
            //Logging.s_mode = Logging.LOG_MODE.UNKNOWN; //Если назначить неизвестный тип логирования - 1-е сообщения б. утеряны
            //Logging.s_mode = Logging.LOG_MODE.DB;
            Logging.s_mode = Logging.LOG_MODE.FILE_EXE;

            ProgramBase.Start();

            FormMainTransMC formMain = null;

            try { formMain = new FormMainTransMC(); }
            catch (Exception e)
            {
                Logging.Logg().Exception(e, "Ошибка запуска приложения.", Logging.INDEX_MESSAGE.NOT_SET);
            }

            if (!(formMain == null))
            {
                Application.Run(formMain);
            }
            else
            {
                ;
            }

            ProgramBase.Exit();
        }
예제 #9
0
        static void Main()
        {
            int iRes = 0;

            //Logging.s_mode = Logging.LOG_MODE.UNKNOWN; //Если назначить неизвестный тип логирования - 1-е сообщения б. утеряны
            //Logging.s_mode = Logging.LOG_MODE.DB;
            Logging.s_mode = Logging.LOG_MODE.FILE_EXE;

            try { ProgramBase.Start(); }
            catch (Exception e)
            {
                //MessageBox.Show(null, @"Возможно, повторный запуск приложения" + @".\nили обратитесь к оператору тех./поддержки по тел. 4444 или по тел. 289-03-37.", "Ошибка инициализации!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                MessageBox.Show(null, e.Message + "\nили обратитесь к оператору тех./поддержки по тел. 4444 или по тел. 289-03-37.", "Ошибка инициализации!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                iRes = -1;
            }

            FormMain formMain = null;

            if (iRes == 0)
            {
                string strHeader = string.Empty;
                try { formMain = new FormMain(); }
                catch (Exception e)
                {
                    strHeader = "Ошибка запуска приложения";
                    MessageBox.Show((IWin32Window)null, e.Message + Environment.NewLine + ProgramBase.MessageAppAbort, strHeader);
예제 #10
0
        static void Main()
        {
            //Logging.s_mode = Logging.LOG_MODE.UNKNOWN; //Если назначить неизвестный тип логирования - 1-е сообщения б. утеряны
            //Logging.s_mode = Logging.LOG_MODE.DB;
            Logging.s_mode = Logging.LOG_MODE.FILE_EXE;
            ProgramBase.Start();
            FormMainTransMC formMain = null;

            if (FormMainStatistic.SingleInstance.Start())
            {
            }
            else
            {
                if (FormMainStatistic.SingleInstance.stopbflg)
                {
                    try
                    { formMain = new FormMainTransMC(); }
                    catch (Exception e)
                    { Logging.Logg().Exception(e, "Ошибка запуска приложения.", Logging.INDEX_MESSAGE.NOT_SET); }

                    try
                    { Application.Run(formMain); }
                    catch (Exception e)
                    { Logging.Logg().Exception(e, "Ошибка выполнения приложения.", Logging.INDEX_MESSAGE.NOT_SET); }

                    FormMainStatistic.SingleInstance.StopMtx();
                }
                else
                {
                    ;
                }
            }
            ProgramBase.Exit();
        }
예제 #11
0
        static void Main(string[] args)
        {
            ProgramBase.Start(Logging.LOG_MODE.FILE_EXE, false);

            string msg = @"Старт приложения [" + DateTime.Now.ToString(@"dd.MM.yyyy HH:mm:ss.fff" + @"]");

            Console.WriteLine(msg);

            object objTest  = null;
            Type   typeTest =
                ////Вариант №1
                //typeof(biysktmora_test)
                ////Вариант №2
                //typeof(ClassDataTableDistinct)
                ////Вариант №3
                //typeof(ClassDataTableDistinct)
                ////Вариант №4
                //typeof(ClassQueueRemoveAt)
                ////Вариант №4
                //typeof(ClassFormulaParsing)
                //Вариант №5
                typeof(HandlerUnRegister)
            ;

            try {
                objTest = Activator.CreateInstance(typeTest
                                                   //// для вар. №4
                                                   //, @"a1+a2", new VariableValue[] { new VariableValue(1F, @"a1"), new VariableValue(2F, @"a2") }
                                                   );
            }
            catch (Exception e)
            {
                msg = e.Message;
                Logging.Logg().Exception(e, @"Activator.CreateInstance (" + typeTest.FullName + @") - ...", Logging.INDEX_MESSAGE.NOT_SET);
                Console.WriteLine(Environment.NewLine + msg);
            }

            msg = @"Выход из приложения [" + DateTime.Now.ToString(@"dd.MM.yyyy HH:mm:ss.fff" + @"]");
            Console.WriteLine(Environment.NewLine + msg);

            Console.Write("\t\nPress any key to exit program...");
            if (objTest is timer_test)
            {
                if (timer_test.iActived == timer_test.STATE.OFF)
                {
                    Console.ReadKey(true);
                }
                else
                {
                    ;
                }
            }
            else
            {
                Console.ReadKey(true);
            }
            Console.WriteLine(Environment.NewLine);

            ProgramBase.Exit();
        }
예제 #12
0
 /// <summary>
 /// Logs an exception.
 /// </summary>
 /// <param name="ex">Exception to log.</param>
 /// <param name="customMessage">Message text to log, exception message will be appended.</param>
 public static void Log(this Exception ex, string customMessage = "ERROR: An exception occurred: ")
 {
     ProgramBase.ConsoleWriteColored(ConsoleColor.Red, () =>
     {
         MySandboxGame.Log.WriteLineAndConsole(customMessage + ex.Message);
         MySandboxGame.Log.WriteLineToConsole("Check the log file for details.");
         MySandboxGame.Log.WriteLine(ex.StackTrace);
     });
 }
예제 #13
0
        /**
         * determines the foreground window on computer
         **/
        private static void determineForegroundWindow()
        {
            IntPtr currentForeground = GetForegroundWindow();

            if (_processDict.Keys.Contains(currentForeground.ToInt32()))
            {
                currentProcess = _processDict[currentForeground.ToInt32()];
            }
        }
예제 #14
0
 private static Command RootCommand() =>
 Command("dotnet-migrate-2019",
         ".NET Project Migration Tool",
         NoArguments(),
         ProgramBase.Wizard(),
         ProgramBase.Evaluate(),
         ProgramBase.Migrate(),
         ProgramBase.Analyze(),
         ProgramBase.HelpOption(),
         ProgramBase.VerbosityOption());
예제 #15
0
        static async Task Main(string[] args)
        {
            var buildType = "";

#if DEBUG
            buildType = "Debug";
#else
            buildType = "Release";
#endif
            await ProgramBase.InitAsync(CreateHostBuilder, buildType, args);
        }
 private void btnView_Click(object sender, EventArgs e)
 {
     try
     {
         System.Diagnostics.Process.Start(txtDirectory.Text);
     }
     catch (Exception ex)
     {
         ProgramBase.ShowError(ex);
     }
 }
예제 #17
0
        private static void Main(string[] args)
        {
            var buildType = "";

#if DEBUG
            buildType = "Debug";
#else
            buildType = "Release";
#endif
            ProgramBase.Init(CreateHostBuilder, buildType, args);
        }
예제 #18
0
 /**
  * Constructor
  * initializes processList and currentProcess
  * @return: all Processes in List format
  **/
 static ProgramManager()
 {
     //cListener = new ConnectionListener();
     //cListener.onConnect += new ConnectionListener.onConnectEvent(onConnected);
     //cListener.sendInitialBroadcast();
     //cListener.listenForClient();
     converter      = new ImageConverter();
     _processDict   = new Dictionary <int, ProgramBase>();
     currentProcess = null;
     determineForegroundWindow();
 }
예제 #19
0
        protected override void OnRun()
        {
            this.notPublishedMissingWin32FunctionsLog = new Log()
            {
                Filename          = "NotPublishedMissingWin32Functions_Log.txt",
                AnnouncementStyle = ConsoleWriteStyle.Default,
                Headers           = new string[] { "binaryName", "functionName" }
            };
            this.RegisterLog(this.notPublishedMissingWin32FunctionsLog);

            this.publishedMissingWin32FunctionsLog = new Log()
            {
                Filename          = "PublishedMissingWin32Functions_Log.txt",
                AnnouncementStyle = ConsoleWriteStyle.Default,
                Headers           = new string[] { "binaryName", "functionName" }
            };
            this.RegisterLog(this.publishedMissingWin32FunctionsLog);

            //this.uniqueKeyMap = this.LoadUniqueKeyMap("uniqueKeyMap.txt");
            this.functionsInDesktopExperienceButNotInServerCore = this.LoadNonUniqueKeyMap("functionsInDesktopExperienceButNotInServerCore.txt");

            int totalValidMissingWin32FunctionNames   = 0;
            int notPublishedMissingWin32FunctionNames = 0;
            int publishedMissingWin32FunctionNames    = 0;

            var apiRefModelWin32 = ApiRefModelWin32.GetApiRefModelWin32(Platform.Win32DesktopAndWsuaDotTxt);

            foreach (var binaryName in this.functionsInDesktopExperienceButNotInServerCore.Keys)
            {
                totalValidMissingWin32FunctionNames += this.functionsInDesktopExperienceButNotInServerCore[binaryName].Count;

                foreach (var functionName in this.functionsInDesktopExperienceButNotInServerCore[binaryName])
                {
                    FunctionWin32InDocs foundFunctionWin32 = null;
                    apiRefModelWin32.GetFunctionWin32ByName(functionName, ref foundFunctionWin32);

                    if (foundFunctionWin32 != null)
                    {
                        ++publishedMissingWin32FunctionNames;
                        this.publishedMissingWin32FunctionsLog.AddEntry(binaryName, functionName);
                    }
                    else
                    {
                        ++notPublishedMissingWin32FunctionNames;
                        this.notPublishedMissingWin32FunctionsLog.AddEntry(binaryName, functionName);
                    }
                }
            }

            ProgramBase.ConsoleWrite(string.Format("{0} valid names in functionsInDesktopExperienceButNotInServerCore.txt", totalValidMissingWin32FunctionNames));
            ProgramBase.ConsoleWrite(string.Format("{0} of those are published", publishedMissingWin32FunctionNames));
            ProgramBase.ConsoleWrite(string.Format("{0} are not published", notPublishedMissingWin32FunctionNames));
        }
예제 #20
0
        public bool Connect(bool showMessage)
        {
            Cursor      = Cursors.WaitCursor;
            IsConnected = false;

            try
            {
                string cs;
                if (IsBuild())
                {
                    var ctrls = controls.ToDictionary(p => p.Control);
                    DbConnectionStringBuilder csb = Database.BuildConnectionString(providerType, ctrls[txtHost].Text, ctrls[txtDatabase].Text, ctrls[txtUserId].Text, ctrls[txtPassword].Text, ctrls[chkIntegSec].Boolean, ctrls[numPort].Integer, ctrls[chkEmbedded].Boolean);
                    cs = csb.ConnectionString;
                }
                else
                {
                    cs = txtConnectionString.Text.Trim();
                }

                if (!string.IsNullOrEmpty(cs))
                {
                    using (var db = new Database(providerType, cs))
                    {
                        db.Open();
                        db.Close();
                    }
                    ViewToData();
                    IsConnected = true;
                }
                else
                {
                    throw new Exception("Invalid connection string");
                }

                if (showMessage)
                {
                    ProgramBase.ShowInformation("Database set up successfully: '" + txtDatabase.Text + "'");
                }
            }
            catch (Exception ex)
            {
                if (showMessage)
                {
                    ProgramBase.ShowError(ex);
                }
                IsConnected = false;
            }
            Cursor = Cursors.Default;
            Draw();
            SetControls();
            return(IsConnected);
        }
예제 #21
0
        public ActionResult Edit(int id)
        {
            ProgramBase fetchedObject = m.GetProgramById(id);

            if (fetchedObject == null)
            {
                return(RedirectToAction("index"));
            }
            else
            {
                return(View(fetchedObject));
            }
        }
예제 #22
0
        public ActionResult Delete(int?id)
        {
            ProgramBase itemToDelete = m.GetProgramById(id.GetValueOrDefault());

            if (itemToDelete == null)
            {
                return(RedirectToAction("index"));
            }
            else
            {
                return(View(itemToDelete));
            }
        }
예제 #23
0
        static void Main(string[] args)
        {
            ProgramBase.Start(Logging.LOG_MODE.FILE_EXE, false);

            HCmd_Arg cmdArg;

            TimeSpan  tsIntervalSeries = TimeSpan.Zero;
            IPAddress ip = IPAddress.Loopback;

            UdpServer udpServer;

            try {
                cmdArg = new HCmd_Arg();

                if (!(cmdArg.Length > 2))
                {
                    ip = (IPAddress)cmdArg.ElementAt(@"dest");

                    tsIntervalSeries = (TimeSpan)cmdArg.ElementAt(@"period");
                }
                else
                {
                    Console.WriteLine(string.Format(@"Ошибка при разборе аргументов командной строки - некорректное кол-во"));
                    Logging.Logg().Error(string.Format(@"Разбор аргументов командной строки - некорректное кол-во"), Logging.INDEX_MESSAGE.NOT_SET);

                    Console.WriteLine(string.Format(@"Допустимые аргументы командной строки:{0}
                        {1}")
                                      , Environment.NewLine
                                      , cmdArg.List
                                      );
                }
            } catch (Exception e) {
                Console.WriteLine(string.Format(@"Исключение при разборе аргумента [{1}] командной строки: {0}", e.Message, args[0]));
                Logging.Logg().Exception(e, string.Format(@"Разбор аргумента [{0}] командной строки", args[0]), Logging.INDEX_MESSAGE.NOT_SET);
            }

            udpServer = new UdpServer(ip, tsIntervalSeries);
            udpServer.Start();

            Console.WriteLine(string.Format(@"Для продолжения нажмите любую..."));
            //Console.CancelKeyPress += onCancelKeyPress;
            Console.ReadKey(true);

            try {
                udpServer.Stop();
            } catch (Exception e) {
                Console.WriteLine(string.Format(@"Исключение: {0}", e.Message));
            }

            GC.Collect();
        }
 private static IHostBuilder CreateHostBuilder(string[] args)
 {
     return(ProgramBase.CreateHostBuilderDefaults(args,
                                                  configBuilder =>
     {
         configBuilder.SetBasePath(AppContext.BaseDirectory)
         .AddJsonFile("appsettings.json", false, true)
         ;
     },
                                                  webBuilder =>
     {
         webBuilder.UseStartup <Startup>();
     }));
 }
예제 #25
0
 public static void addProgram(int key, ProgramBase pInt)
 {
     _processDict.Add(key, pInt);
     currentProcess = pInt;
     try
     {
         CompRequest message = WireProtocol.createProgramMessage(Guid.NewGuid().ToString(), key, pInt.WindowTitle, (byte[])converter.ConvertTo(pInt.WindowCap, typeof(byte[])), pInt.ProgramType);
         //cListener.phoneCommChannel.startThread(WireProtocol.serializeMessage(message));
     }
     catch (NullReferenceException e) {
         Console.WriteLine(e.ToString());
     }
     //send phone update on process
 }
예제 #26
0
        static void Main()
        {
            int iRes = 0;

            ProgramBase.s_iAppID = 0;
            Logging.UserId       = 0;
            try { ProgramBase.Start(Logging.LOG_MODE.FILE_EXE, true); }
            catch (Exception e)
            {
                //MessageBox.Show(null, @"Возможно, повторный запуск приложения" + @".\nили обратитесь к оператору тех./поддержки по тел. 4444 или по тел. 289-03-37.", "Ошибка инициализации!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                MessageBox.Show(null, e.Message + "\nили обратитесь к оператору тех./поддержки по тел. 4444 или по тел. 289-03-37.", "Ошибка инициализации!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                iRes = -1;
            }

            FormMain formMain = null;

            if (iRes == 0)
            {
                string strHeader = string.Empty;
                try { formMain = new FormMain(); }
                catch (Exception e)
                {
                    strHeader = "Ошибка запуска приложения";
                    MessageBox.Show((IWin32Window)null, e.Message + Environment.NewLine + ProgramBase.MessageAppAbort, strHeader);
                    Logging.Logg().Exception(e, strHeader, Logging.INDEX_MESSAGE.NOT_SET);
                }

                if (!(formMain == null))
                {
                    try { Application.Run(formMain); }
                    catch (Exception e)
                    {
                        strHeader = "Ошибка выполнения приложения";
                        MessageBox.Show((IWin32Window)null, e.Message + Environment.NewLine + ProgramBase.MessageAppAbort, strHeader);
                        Logging.Logg().Exception(e, strHeader, Logging.INDEX_MESSAGE.NOT_SET);
                    }
                }
                else
                {
                    ;
                }

                ProgramBase.Exit();
            }
            else
            {
                ;
            }
        }
예제 #27
0
        static void Main(string[] args)
        {
            ProgramBase.Start(false);

            string msg = @"Старт приложения [" + DateTime.Now.ToString(@"dd.MM.yyyy HH:mm:ss.fff" + @"]");

            Console.WriteLine(msg);

            DataTable dt1 = new DataTable()
            , dt2         = new DataTable();

            dt1.Columns.Add(@"ID", typeof(int));
            dt1.Columns.Add(@"DATETIME", typeof(DateTime));
            dt1.Columns.Add(@"VALUE", typeof(decimal));

            dt2 = dt1.Clone();

            dt1.Rows.Add(new object[] { 1, DateTime.Now, 12.3 });
            dt1.Rows.Add(new object[] { 2, DateTime.Now, 23.4 });
            dt1.Rows.Add(new object[] { 1, DateTime.Now, 34.5 });

            dt2.Rows.Add(new object[] { 2, DateTime.Now, 12.4 });
            dt2.Rows.Add(new object[] { 1, DateTime.Now, 23.5 });
            dt2.Rows.Add(new object[] { 2, DateTime.Now, 34.6 });

            dt1.Merge(dt2, true);

            ////Вариант №1
            ////ТаблицаБезОдинаковыхСтрок = YourTable.DefaultView.ToTable(true,ColumnList);
            //dt1 = dt1.DefaultView.ToTable(true, @"ID", @"DATETIME");

            //IEnumerable<DataRow> distinctRows = dt1.AsEnumerable().Distinct(c >= (DataRow)c[@"DATETIME"]);
            var vRes = dt1.AsEnumerable().Select(c => (DataRow)c["ID"]).Distinct().ToList();

            Type typeTest =
                //Вариант №1
                typeof(biysktmora_test)
            ;

            object objTest = Activator.CreateInstance(typeTest);

            msg = @"Выход из приложения [" + DateTime.Now.ToString(@"dd.MM.yyyy HH:mm:ss.fff" + @"]");
            Console.WriteLine(Environment.NewLine + msg);

            Console.Write("\t\nPress any key to exit program..."); Console.ReadKey(true);
            Console.WriteLine(Environment.NewLine);

            ProgramBase.Exit();
        }
예제 #28
0
        static void Main(string[] args)
        {
            ProgramBase.Start(false);

            string msg = @"Старт приложения [" + DateTime.Now.ToString(@"dd.MM.yyyy HH:mm:ss.fff" + @"]");

            Console.WriteLine(msg);

            object objTest  = null;
            Type   typeTest =
                ////Вариант №1
                //typeof(biysktmora_test)
                ////Вариант №2
                //typeof(ClassDataTableDistinct)
                //Вариант №3
                typeof(srcktstusql_test)
            ;

            try { objTest = Activator.CreateInstance(typeTest); }
            catch (Exception e)
            {
                msg = e.Message;
                Logging.Logg().Exception(e, @"Activator.CreateInstance (" + typeTest.FullName + @") - ...", Logging.INDEX_MESSAGE.NOT_SET);
                Console.WriteLine(Environment.NewLine + msg);
            }

            msg = @"Выход из приложения [" + DateTime.Now.ToString(@"dd.MM.yyyy HH:mm:ss.fff" + @"]");
            Console.WriteLine(Environment.NewLine + msg);

            Console.Write("\t\nPress any key to exit program...");
            if (objTest is timer_test)
            {
                if (timer_test.iActived == timer_test.STATE.OFF)
                {
                    Console.ReadKey(true);
                }
                else
                {
                    ;
                }
            }
            else
            {
                Console.ReadKey(true);
            }
            Console.WriteLine(Environment.NewLine);

            ProgramBase.Exit();
        }
예제 #29
0
        static void Main()
        {
            int      iRes     = 0;
            FormMain formMain = null;

            Logging.s_mode = Logging.LOG_MODE.FILE_EXE;

            try { ProgramBase.Start(); }
            catch (Exception e) {
                MessageBox.Show(null, e.Message + "\nили обратитесь к оператору тех./поддержки по тел. 4444 или по тел. 289-03-37.", "Ошибка инициализации!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                iRes = -1;
            }

            if (iRes == 0)
            {
                string strHeader = string.Empty;
                try {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    formMain = new FormMain();
                } catch (Exception e) {
                    strHeader = "Ошибка запуска приложения";
                    MessageBox.Show((IWin32Window)null, e.Message + Environment.NewLine + ProgramBase.MessageAppAbort, strHeader);
                    Logging.Logg().Exception(e, strHeader, Logging.INDEX_MESSAGE.NOT_SET);
                }

                if (!(formMain == null))
                {
                    try {
                        Application.Run(formMain);
                    } catch (Exception e) {
                        strHeader = "Ошибка выполнения приложения";
                        MessageBox.Show((IWin32Window)null, e.Message + Environment.NewLine + ProgramBase.MessageAppAbort, strHeader);
                        Logging.Logg().Exception(e, strHeader, Logging.INDEX_MESSAGE.NOT_SET);
                    }
                }
                else
                {
                    ;
                }

                ProgramBase.Exit();
            }
            else
            {
                ;
            }
        }
예제 #30
0
        static void Main()
        {
            Logging.s_mode = Logging.LOG_MODE.FILE_EXE;

            ProgramBase.Start();

            FIleConnSett           fileConnSett = new FIleConnSett("connsett.ini", FIleConnSett.MODE.FILE);
            FormConnectionSettings formConnSett = new FormConnectionSettings(-1, fileConnSett.ReadSettingsFile, fileConnSett.SaveSettingsFile);

            int idListener = DbSources.Sources().Register(formConnSett.getConnSett(), false, @"CONFIG_DB");

            Application.Run(new FormMain_DB(idListener, new InitTEC_200(idListener, true, false).tec));
            DbSources.Sources().UnRegister(idListener);

            ProgramBase.Exit();
        }