public void SetValue(Customer c) { this.curstatus = Status.EDIT; curcsinfor = c; this.txt_customername.Text = c.CustomerName; this.txt_department.Text = c.Department; this.txt_companyaddress.Text = c.Address; this.txt_companyname.Text = c.CompanyName; this.txt_description.Text = c.Description; this.txt_email.Text = c.Email; this.txt_fax.Text = c.Fax; this.txt_homephone.Text = c.HomePhone; this.txt_mobile.Text = c.Mobile; this.txt_position.Text = c.Position; this.txt_website.Text = c.WebSite; this.txt_zip.Text = c.Zip; this.txt_phone.Text = c.Phone; this.cbx_gender.SelectedValue = c.Gender; }
/// <summary> /// Constructor /// </summary> public Extension() { try { _Status = Status.Loading; if (Required > System.Reflection.Assembly.GetExecutingAssembly().GetName().Version) { Core.DebugLog("CORE: Terminating the extension " + Name + " which requires pidgeon " + Required.ToString()); _Status = Status.Terminated; return; } Initialise(); } catch (Exception fail) { Core.handleException(fail); Core.DebugLog("CORE: Terminating the extension " + Name); _Status = Status.Terminated; } }
/// <summary> /// Load /// </summary> public void Load() { try { if (!Hook_OnLoad()) { Core.DebugLog("Unable to load " + Name + " the OnLoad hook returned invalid value"); _Status = Status.Stopped; return; } } catch (Exception f) { Core.handleException(f); } }
/// <summary> /// This hook is part of contructor, you can override this with constructor of extension /// </summary> public virtual void Initialise() { if (Name == "Unknown extension") { _Status = Status.Stopped; throw new Core.PidgeonException("Extension had no Initialise() function and was terminated"); } }
/// <summary> /// Terminate this extension /// </summary> public void Exit() { try { Core.DebugLog("CORE: Unloading " + Name); _Status = Status.Terminating; if (!Hook_Unload()) { Core.DebugLog("CORE: Failed to unload " + Name + " forcefully removing from memory"); lock (_Threads) { foreach (Thread thread in _Threads) { try { if (thread.ThreadState == ThreadState.WaitSleepJoin || thread.ThreadState == ThreadState.Running) { thread.Abort(); } } catch (Exception fail) { Core.DebugLog("CORE: Failed to unload " + Name + " error " + fail.ToString()); } } } } lock (Core.Extensions) { if (Core.Extensions.Contains(this)) { Core.Extensions.Remove(this); Core.DebugLog("CORE: Unloaded " + Name); } } _Status = Status.Terminated; Core.DebugLog("CORE: Terminated " + Name); } catch (Exception fail) { Core.handleException(fail); } }
private void Dg_sa_MouseDoubleClick(object sender, MouseButtonEventArgs e) { SendungsanfrageDTO saDTO = (SendungsanfrageDTO)dg_sa.SelectedItem; Status status = new Status(auftragService, saDTO); status.ShowDialog(); FillSendungsanfragen(); FillTransportplaene(); }
/// <summary> /// This is a first function that should be called after application start /// </summary> /// <returns></returns> public static bool Load() { if (Status.Loading != _Status) { throw new Core.PidgeonException("You can't load core multiple times"); } try { KernelThread = Thread.CurrentThread; LoadTime = DateTime.Now; // turn on debugging until we load the config Configuration.Kernel.Debugging = true; SystemRoot = Application.StartupPath + Path.DirectorySeparatorChar; if (Root == null && Application.LocalUserAppDataPath.EndsWith(Application.ProductVersion, StringComparison.Ordinal)) { Root = Application.LocalUserAppDataPath.Substring(0, Application.LocalUserAppDataPath.Length - Application.ProductVersion.Length); ConfigFile = Root + "configuration.dat"; } else if (Root == null) { Root = System.Windows.Forms.Application.LocalUserAppDataPath + Path.DirectorySeparatorChar; ConfigFile = Root + "configuration.dat"; } Ringlog("Pidgeon " + Application.ProductVersion.ToString() + " loading core"); KernelProc = Process.GetCurrentProcess(); if (Configuration.Kernel.Safe) { Ringlog("Running in safe mode"); } foreach (string data in Program.Parameters) { startupParams.Add(data); } Configuration.Logs.logs_dir = Root + "logs"; Ringlog("Root path is " + Root); Ringlog("Config file: " + ConfigFile); Configuration.irc.CertificateDCC = Root + "certificate.p12"; string is64 = " which is a 32 bit system"; if (Environment.Is64BitOperatingSystem) { is64 = " which is a 64 bit system"; } Ringlog("This pidgeon is compiled for " + Configuration.CurrentPlatform.ToString() + " and running on " + Environment.OSVersion.ToString() + is64); DebugLog("Loading messages"); messages.Read(Configuration.Kernel.Safe); trafficscanner = new Forms.TrafficScanner(); if (!System.IO.File.Exists(Application.StartupPath + System.IO.Path.DirectorySeparatorChar + "pidgeon.dat")) { LoadSkin(); DebugLog("Loading configuration file"); Configuration.Kernel.Debugging = false; Core._Configuration.ConfigurationLoad(); if (!Directory.Exists(PermanentTemp)) { Directory.CreateDirectory(PermanentTemp); } if (Configuration.Kernel.Safe) { DebugLog("Not running updater in safe mode"); } else { DebugLog("Running updater"); ThUp = new Thread(Updater.Run); ThUp.Name = "pidgeon service"; ThUp.Start(); SystemThreads.Add(ThUp); } DebugLog("Loading log writer thread"); Thread_logs = new Thread(IO.Load); Thread_logs.Name = "Logs"; SystemThreads.Add(Thread_logs); Thread_logs.Start(); DebugLog("Loading commands"); Commands.Initialise(); notification = new Forms.Notification(); //DebugLog("Loading scripting core"); //ScriptingCore.Load(); if (Configuration.Kernel.Safe) { DebugLog("Skipping load of extensions"); } else { DebugLog("Loading extensions"); Extension.Init(); if (Directory.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "modules")) { foreach (string dll in Directory.GetFiles(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "modules", "*.pmod")) { DebugLog("Registering plugin " + dll); RegisterPlugin(dll); } } } DebugLog("Loading http"); Hyperlink.Initialize(); if (!File.Exists(ConfigFile)) { Commands.RegisterAlias("j", "join", false); if (Configuration.CurrentPlatform == Platform.Linuxx86 || Configuration.CurrentPlatform == Platform.Linuxx64) { Commands.RegisterAlias("grep", "pidgeon.term grep", false); Commands.RegisterAlias("shell", "pidgeon.term2in", false); } Network.Highlighter simple = new Network.Highlighter(); simple.enabled = true; simple.text = "$nick"; Configuration.HighlighterList.Add(simple); } ResetMainActivityTimer(); Hooks._Sys.AfterCore(); _Status = Status.Running; return true; } Updater _finalisingupdater = new Updater(); _finalisingupdater.update.Visible = false; _finalisingupdater.finalize = true; _finalisingupdater.lStatus.Text = messages.get("update2"); _Status = Status.Killed; System.Windows.Forms.Application.Run(_finalisingupdater); } catch (Exception panic) { Core.DebugLog("Failed to Core.Load: " + panic.Message + panic.StackTrace); Core.handleException(panic, true); } return false; }
/// <summary> /// Exit /// </summary> /// <returns>true</returns> public static bool Quit() { try { Core.DebugLog("User requested a shut down"); if (_Status == Status.Quiting) { Core.DebugLog("Multiple calls of Core.Quit() ignored"); return false; } _Status = Status.Quiting; if (!IgnoreErrors) { IgnoreErrors = true; if (Configuration.UserData.TrayIcon) { SystemForm.icon.Visible = false; SystemForm.icon.Dispose(); } SystemForm.Hide(); notification.Hide(); _Configuration.ConfigSave(); try { foreach (Protocol server in Connections) { Core.Ringlog("Exiting network " + server.Server); server.Exit(); } } catch (Exception fail) { Core.handleException(fail); } foreach (Thread th in SystemThreads) { try { Core.Ringlog("CORE: Thread " + th.ManagedThreadId.ToString() + " needs to be terminated now"); Core.KillThread(th); } catch (Exception fail) { Core.handleException(fail); } } Thread.Sleep(800); Core.DebugLog("Exiting with code 0"); Environment.Exit(0); } } catch (Exception fail) { Console.WriteLine(fail.StackTrace.ToString()); if (KernelProc != null) { KernelProc.Kill(); } } return true; }