Example #1
0
        public static Tuple <StructureValueForClient, string> GetParamatersForClientReady(List <string> ListNameOfValue) // Для запроса по нажатию, получает уже готовый результат
        {
            StructureValueForClient           ReturnStruct = default;
            ProgressOfUpdateAtStructAttribute Progress     = (ProgressOfUpdateAtStructAttribute)ParentMethods.GetStandart().Clone_Full();

            Progress.NonSerializedConfig.IsInTask = false;
            Progress.NonSerializedConfig.Method   = new Action(() =>
            {
                DateTime Start = DateTime.Now;

                try
                {
                    ReturnStruct = AutoRefresh_ServerPart.GetParamatersForClientReady(ListNameOfValue);
                }
                catch (Exception ex)
                {
                    try
                    {
                        ReturnStruct = AutoRefresh_ServerPart.GetParamatersForClientReady(ListNameOfValue);
                    }
                    catch (Exception exx)
                    {
                    }
                }

                TimeSpan TimeSpend = DateTime.Now - Start;
                ReturnStruct.TimeServerOnGetProperties   = TimeSpend;
                ReturnStruct.TimeServerWhenGetProperties = DateTime.Now.TimeOfDay;
            });
            Progress.Start();

            return(new Tuple <StructureValueForClient, string>(ReturnStruct, Progress.ExceptionMessage));
        }
Example #2
0
        static void Main(string[] args)
        {
            //Helper.CheckDirectories();
            var CurrentDomain    = AppDomain.CurrentDomain.BaseDirectory;
            var GetDirectoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            Console.WriteLine("AppDomain.CurrentDomain.BaseDirectory: {0}", CurrentDomain);
            Console.WriteLine("Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location): {0}", GetDirectoryName);
            ManualResetEvent manualResetEvent = new ManualResetEvent(true);

            manualResetEvent.WaitOne();

            ConsoleWriteLine.WriteInConsole(null, null, null, "Project started", ConsoleColor.White);
            Process.GetCurrentProcess().PriorityClass        = ProcessPriorityClass.RealTime;
            Process.GetCurrentProcess().PriorityBoostEnabled = true;

            Helper_WINWORD.Clear();
            Helper_EXCEL.Clear();
            ClearNormal();

            ProgressOfUpdateAtStructAttribute Standart = (ProgressOfUpdateAtStructAttribute)ParentMethods.GetStandart().Clone_Full();

            ValueForClient.DeserializeConfig(new TimeSpan(0, 5, 0)); // Deserialization data'es

            if (ValueForClient.ReadyStructure.ProgressOfUpdate is null ? true : ValueForClient.ReadyStructure.ProgressOfUpdate.List_ProgressOfUpdateAtStructAttribute.Count != 1)
            {
                Progress = Standart;
                ValueForClient.ReadyStructure.ProgressOfUpdate = new ProgressOfUpdate()
                {
                    List_ProgressOfUpdateAtStructAttribute = new List <ProgressOfUpdateAtStructAttribute>()
                    {
                        Progress
                    }
                };
            }
Example #3
0
        public static void UpdateConfig(ProgressOfUpdateAtStructAttribute Parent)
        {
            string CurrDirect = Directory.GetParent(LocalSettings.ApplicationBasePath).Parent.Parent.Parent.Parent.FullName;

            NewBasePath = Path.Combine(CurrDirect, "ForSYSTECH_DB.db");
            Tuple <SQLiteConnection, string> tuple = ConnectToDataBase.TryToConnectToSQLite(NewBasePath);

            ConnectToDataBase.sqlite_conn = tuple.Item1;
        }
Example #4
0
        private static void ListenerTcpIp(ProgressOfUpdateAtStructAttribute Parent)
        {
            ProgressOfUpdateAtStructAttribute Progress = Parent.NonSerializedConfig.GetOnEntry;

            Progress.SetName("Сетевой протокол");
            Progress.NonSerializedConfig.Method = new Action(() =>
            {
                TimeSpan Interval = new TimeSpan(0, 2, 0);
                ListenSockets.SetConfigAndStart(ThreadPriority.Highest, ListenSockets.GetType().AssemblyQualifiedName, "Прослушка сокета", null, Progress, Interval,
                                                Interval
                                                , true, ConsoleColor.White);
            });
            Progress.Start();
        }
Example #5
0
        public static Tuple <StructureValueForClient, string> CheckAutoRefresh(StructureValueForClient StructureValueForClient)
        {
            StructureValueForClient           Text     = default;
            ProgressOfUpdateAtStructAttribute Progress = (ProgressOfUpdateAtStructAttribute)ParentMethods.GetStandart().Clone_Full();

            Progress.NonSerializedConfig.IsInTask = false;
            Progress.NonSerializedConfig.Method   = new Action(() =>
            {
                Text = AutoRefresh_ServerPart.CheckAutoRefresh(StructureValueForClient);
            });
            Progress.Start();

            return(new Tuple <StructureValueForClient, string>(Text, Progress.ExceptionMessage));
        }
        public override MainParentClass Menu_Virtual(ProgressOfUpdateAtStructAttribute Parent)
        {
            ProgressOfUpdateAtStructAttribute Progress = Parent.NonSerializedConfig.GetOnEntry;

            Progress.SetName(nameof(ListenSockets));
            Progress.NonSerializedConfig.Method = new Action(() =>
            {
                Task.Run(() =>
                {
                    ConnectFromServer.StartListening(typeof(MethodsCall).AssemblyQualifiedName, 11000);
                });
            });
            Progress.Start();

            return(default);
        public override MainParentClass Menu_Virtual(ProgressOfUpdateAtStructAttribute Parent)
        {
            Users Users = new Users();
            ProgressOfUpdateAtStructAttribute Progress = Parent.NonSerializedConfig.GetOnEntry;

            Progress.SetName(nameof(HR_Methods));
            Progress.NonSerializedConfig.Method = new Action(() =>
            {
                Tuple <SQLiteConnection, string> tuple = ConnectToDataBase.TryToConnectToSQLite(LocalSettings.NewBasePath);

                using (SQLiteConnection SQLiteConnection = tuple.Item1)
                {
                    Users.User_s = GetUsers(SQLiteConnection);
                }
            });
            Progress.Start();

            return(Users);
        }
Example #8
0
        public static void OnLoad(ProgressOfUpdateAtStructAttribute Parent)
        {
            ProgressOfUpdateAtStructAttribute Progress = Parent.NonSerializedConfig.GetOnEntry;

            Progress.SetName("Запуск основных участком/модулей");
            Progress.NonSerializedConfig.Method = new Action(() =>
            {
                #region ServerMethods
                Thread thread_HR_Methods = new Thread(() =>
                {
                    bool StartConfiguration_AtNow = true;
                    TimeSpan HowOftenCheck        =
                        //default;
                        TimeSpan.FromMinutes(1);
                    TimeSpan Interval = new TimeSpan(1, 0, 0);
                    HR_Methods.SetConfigAndStart(ThreadPriority.BelowNormal, LocalSettings.HR_Methods.GetType().AssemblyQualifiedName, nameof(StructureValueForClient.HR), nameof(StructureValueForClient.HR), new ProgressOfUpdateAtStructAttribute(), Interval, HowOftenCheck, StartConfiguration_AtNow, ConsoleColor.Yellow);
                });
                thread_HR_Methods.Priority     = ThreadPriority.BelowNormal;
                thread_HR_Methods.IsBackground = true;
                thread_HR_Methods.Start();
                //thread_HR_Methods.Join();

                Thread thread_Users_Methods = new Thread(() =>
                {
                    bool StartConfiguration_AtNow = true;
                    TimeSpan HowOftenCheck        =
                        //default;
                        TimeSpan.FromMinutes(1);
                    TimeSpan Interval = new TimeSpan(1, 0, 0);
                    Users_Methods.SetConfigAndStart(ThreadPriority.BelowNormal, LocalSettings.Users_Methods.GetType().AssemblyQualifiedName, nameof(StructureValueForClient.Users), nameof(StructureValueForClient.Users), new ProgressOfUpdateAtStructAttribute(), Interval, HowOftenCheck, StartConfiguration_AtNow, ConsoleColor.Yellow);
                });
                thread_Users_Methods.Priority     = ThreadPriority.BelowNormal;
                thread_Users_Methods.IsBackground = true;
                thread_Users_Methods.Start();
                //thread_Users_Methods.Join();
                #endregion

                ListenerTcpIp(Progress); // Listen sockets Thread
            });
            Progress.Start();
        }
Example #9
0
 public override MainParentClass Menu_Virtual(ProgressOfUpdateAtStructAttribute Parent)
 {
     throw new NotImplementedException();
 }