private void addTicket_Load(object sender, EventArgs e) { this.Text += " - " + Program.TicketDB.CurrentUser.Nome; this.Update(); List <Area> Areas = Program.TicketDB.ProcuraAreas(); foreach (Area Area in Areas) { cbxTAvaria.Items.Add(Area.ToString()); } Program.TicketDB.ProcuraPerfis(); List <Prioridade> Prioridades = Program.TicketDB.ProcuraPrioridade(); foreach (Prioridade Prio in Prioridades) { cbxPrioridade.Items.Add(Prio.ToString()); } Program.TicketDB.ProcuraPerfis(); List <Equipamento> Equipamentos = Program.TicketDB.ProcuraEquipamentos(); foreach (Equipamento Equip in Equipamentos) { cbxEquipamento.Items.Add(Equip.ToString()); } Program.TicketDB.ProcuraPerfis(); }
public static void Log(String sMsg, Prio ePriorite, Orig eOrigine, bool bMsgBox) { DateTime dt = DateTime.Now; String sLine = dt.Year.ToString() + "/" + dt.Month.ToString().PadLeft(2, '0') + "/" + dt.Day.ToString().PadLeft(2, '0') + "\t" + dt.Hour.ToString().PadLeft(2, '0') + ":" + dt.Minute.ToString().PadLeft(2, '0') + ":" + dt.Second.ToString().PadLeft(2, '0') + "\t" + eOrigine.ToString() + "\t" + ePriorite.ToString() + "\t" + sMsg; if (m_sLogFileDefined) { m_sw.WriteLine(sLine); m_sw.Flush(); } // TODO : vérifier que le destructeur de StreamWriter ferme le fichier }
/// <summary> /// Schreibt in eine Log-Datei wenn DebugBitPos in DegbuByte gesetzt ist oder errorNo < 0 /// </summary> /// <param name="DebugBitPos">Bit-Position in DebugByte</param> /// <param name="errorNo">Eindeutige Fehlernummer</param> /// <param name="logMessage">Text</param> public static void Write(Cat DebugBitPos, Prio prio, int errorNo, string logMessage) //Fehlernummern siehe Log.cs 0701ZZ { if (Tools.IsBitSet(DebugWord, (int)DebugBitPos) || prio != Prio.Info) { LogWrite(string.Format("{0:00} {1} {2:D6}", (int)DebugBitPos, prio.ToString().Substring(0, 1), errorNo), logMessage); } if (DebugBitPos == (int)Log.Cat.Info && Tools.IsBitSet(DebugWord, (int)Log.Cat.Info)) { Console.WriteLine(logMessage); } if (prio == Prio.Error) { Program.AppErrorOccured = true; if (Program.AppErrorNumber < 0) //nur, wenn AppErrorCategory noch nicht gesetzt ist { Program.AppErrorNumber = errorNo; //(int)DebugBitPos; } } }
public async void StartSubscriptionAsync(IRC5Session cs, string resource, T eventArgs) { Cs = cs; if (Cs.IsOmnicore) { Protocol = "rws_subscription"; TemplateSocketUrl = "wss://{0}/poll"; } using HttpClientHandler handler = new HttpClientHandler { Credentials = new NetworkCredential(cs?.UAS.User, cs?.UAS.Password) }; handler.Proxy = null; handler.UseProxy = false; handler.ServerCertificateCustomValidationCallback = (sender, certificate, chain, sslPolicyErrors) => { return(true); }; string prioAndResourcePath = Prio + "|" + resource.Replace(resource.Split('/').Last(), ""); int resourceCount = 1; Cs.SubscriptionService.SubscriptionSessions.TryGetValue(prioAndResourcePath, out var outSubscData); resourceCount += outSubscData == null ? 0 : outSubscData.ResourceCount; Tuple <string, string>[] dataParameters = { Tuple.Create("resources", resourceCount.ToString()), Tuple.Create(resourceCount.ToString(), resource), Tuple.Create(resourceCount + "-p", Prio.ToString(CultureInfo.InvariantCulture)) }; string combinedParams = IRC5Session.BuildDataParameters(dataParameters); if (outSubscData != null) { outSubscData.CombinedParameters = (outSubscData.CombinedParameters.Contains(resource) ? outSubscData.CombinedParameters : (outSubscData.CombinedParameters + "&" + combinedParams).TrimStart('&')); outSubscData.ResourceCount = resourceCount; } else { Cs.SubscriptionService.SubscriptionSessions.AddOrOverwrite(prioAndResourcePath, new OpenSubscriptionData() { ResourceCount = resourceCount, CombinedParameters = combinedParams, ResourcePath = prioAndResourcePath.Split('|')[1], GroupID = "1", }); } outSubscData = Cs.SubscriptionService.SubscriptionSessions[prioAndResourcePath]; using HttpContent httpContent = new StringContent(outSubscData.CombinedParameters); httpContent.Headers.Remove("Content-Type"); httpContent.Headers.Add("Content-Type", Cs.ContentTypeHeader); using HttpClient client = new HttpClient(handler); outSubscData.RequestQueue.Add(new Task(() => { StartSubscriptionAsync(Cs, resource, eventArgs); })); if (outSubscData.RequestQueue.Count == 1) { outSubscData.CombinedParameters = ""; await SocketThreadAsync(client, httpContent, eventArgs, prioAndResourcePath); } }