public TimeSummaryObservable(TimePeriodType _timePerType, DateTime _date) { switch (_timePerType) { case TimePeriodType._year: break; case TimePeriodType._month: break; case TimePeriodType._week: break; case TimePeriodType._day: DateTime _dtFloor = ServiceMain.DateTimeFloor(_date, TimePeriodType._month); for (DateTime i = _dtFloor; i < _dtFloor.AddMonths(1); i = i.AddDays(1)) { this.Add(new TimeSummary(i, i.AddDays(1))); } break; case TimePeriodType._hour: break; case TimePeriodType._minute: break; case TimePeriodType._second: break; default: break; } }
public static XIMServer CreateXIMServer(ServiceMain service) { XIMServer s = new XIMServer(); s._service = service; IEntity e = null; if (Program.ConfigMgt.Config.InboundFromFile) { e = new DirectoryMonitor(Program.ConfigMgt.Config.DirectoryConfig, Program.Log); } else { e = SocketEntity.Create(Program.ConfigMgt.Config.SocketConfig); } if (e == null) { return(null); } else { e.OnRequest += new RequestEventHandler(s._entity_OnRequest); s._entity = e; return(s); } }
public Implementation(ServiceMain p_parent) { m_parent = p_parent; m_notificationRequester = new Thread(new ThreadStart(NotificationRequestLoop)); m_queryExecuteIntervalSec = m_parent.Config.GetIntValue("QueryExecuteIntervalSec", 60); SqlConnectionStringBuilder connectStr = new SqlConnectionStringBuilder(); connectStr.ConnectionString = m_parent.Config.GetValue("ConnectString"); // Setting this to true is needed to be able to stop the service gracefully (instead // of killing it after x seconds when the spGetNextNotification is blocking) // connectStr.AsynchronousProcessing = true; m_dbConnection = new SqlConnection( connectStr.ToString() ); try { CheckConnection(); } catch (Exception ex) { throw ex; } }
static void Main(string[] args) { IWinServiceMain svc = new ServiceMain(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new WinServiceDebugForm(svc)); }
public void Prepare() { ServiceManager.Instance.Register <ServiceMain>(); serviceMain = ServiceManager.Instance.Resolve <ServiceMain>(); xml = new XmlDocument(); xml.Load("test_xml.user"); }
public XIMClient(ServiceMain service) { _service = service; //Program.ConfigMgt.Config.SocketConfig.ReceiveEndSign = XIMClientHelper.ResponseEndSign; //Program.ConfigMgt.Config.SocketConfig.SendEndSign = XIMClientHelper.RequestEndSign; _timer = new Timer(Program.ConfigMgt.Config.DataCheckingInterval); _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed); }
public MainForm() { this.MainServices = new ServiceMain(); resultFileName = SavedPath + Guid.NewGuid().ToString() + ".txt"; if (!Directory.Exists(SavedPath)) { Directory.CreateDirectory(SavedPath); } InitializeComponent(); InitControls(); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { ServiceMain serviceMain = new ServiceMain(); serviceMain.Initialize(); #if (DEBUG) serviceMain.Start(); #else ServiceBase.Run(new ServiceBase[] { serviceMain }); #endif }
public VM_Main() { serviceMain = ServiceManager.Instance.Resolve <ServiceMain>(); RegisterValidator <VM_Main, ValidatorMain>(); OnSearch = new SimpleCommand(x => DoWork(false), x => !HaveErrors).Subscribe(this); OnReplace = new SimpleCommand(x => DoWork(true), x => !HaveErrors).Subscribe(this); Subscribe(nameof(PathToInputDirectory), () => LabelCount = "Файлов XML в директории: " + serviceMain.FilesCount(PathToInputDirectory)); }
public void HaveData() { // If there's data to send, check the timers before sending. if (comm.ContentTimer.RemainingDuration <= 0 && comm.BusyTimer.RemainingDuration <= 0) { // Send ENQ comm.Send(Constants.ENQ); // Set transTimer = 15 comm.transTimer.Reset(15); #if DEBUG ServiceMain.AppendToLog("Transaction timer reset: 15."); #endif } }
private static void RunAsConsole() { Console.WriteLine("Mode Console, press key <enter> to exit!"); Console.WriteLine(); Console.WriteLine("Starting the Route Service Provider"); ServiceMain mainService = new ServiceMain(false); mainService.StartServiceHost(); Console.ReadLine(); mainService.StopServiceHost(); Console.WriteLine(); Console.WriteLine("The server has been stopped!"); }
private void CalcDurationSum(ProblemObservable _problemObs) { foreach (TimeSummary tsum in this) { foreach (Problem prob in _problemObs) { if (tsum.DateStart == ServiceMain.DateTimeFloor(prob.StartDateTime, TimePeriodType._day)) { tsum.DurationMinuteSum += prob.DurationProblem.TotalMinutes; } else { if (tsum.DateStart > prob.StartDateTime) { if (prob.Replay) { DateTime _startDateTimeProb = prob.StartDateTime; // каждый день if (prob.ReplayEveryday) { if (prob.EndingNever) { tsum.DurationMinuteSum += prob.DurationProblem.TotalMinutes; } if (prob.EndingCount) { // сделать метод умножения TimeSpan DateTime _endDateTimeProb = prob.StartDateTime.Add(TimeSpan.FromTicks(new TimeSpan(1, 0, 0, 0).Ticks *(prob.CountReplays - 1))); if (_endDateTimeProb >= tsum.DateStart) { tsum.DurationMinuteSum += prob.DurationProblem.TotalMinutes; } } if (prob.EndingDate) { if (prob.EndDateTime >= tsum.DateStart) { tsum.DurationMinuteSum += prob.DurationProblem.TotalMinutes; } } } // каждую неделю if (prob.ReplayEveryweek) { if (prob.EndingNever) { if (prob.DayOfWeekList.Exists(x => x == tsum.DateStart.DayOfWeek)) { tsum.DurationMinuteSum += prob.DurationProblem.TotalMinutes; } } if (prob.EndingCount) { for (int i = prob.CountReplays; i > 0;) { if (prob.DayOfWeekList.Exists(x => x == tsum.DateStart.DayOfWeek)) { tsum.DurationMinuteSum += prob.DurationProblem.TotalMinutes; i--; } } } if (prob.EndingDate) { if (prob.EndDateTime >= tsum.DateStart) { if (prob.DayOfWeekList.Exists(x => x == tsum.DateStart.DayOfWeek)) { tsum.DurationMinuteSum += prob.DurationProblem.TotalMinutes; } } } } // каждый месяц if (prob.ReplayEverymonth) { } // каждый год if (prob.ReplaysEveryyear) { } // другой интервал if (prob.ReplayOther) { } } } } } } }
static void Main(string[] args) { ServiceMain.Start(args); }
public void RcvACK() { // Bask in the praise of the instrument? It's acknowledging us for no reason! // Seriously though, maybe we should add inappropriate incoming transmissions to the log file. ServiceMain.AppendToLog("ACK received in idle state...?"); }
public void RcvData(string InputString) { // Ignore... Possibly log the input for later reference? ServiceMain.AppendToLog("Data received in idle state: " + InputString); }
public void RcvEOT() { // Ignore, but log it. ServiceMain.AppendToLog("EOT received in idle state."); }
public void RcvNAK() { // Ignore. It's just trying to get a rise out of you. ServiceMain.AppendToLog("NAK received in idle state."); }
public StorageSCPService(ServiceMain workListService) { Service = workListService; DicomEncoding.Default = Encoding.GetEncoding("GB18030"); }