Ejemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            icon = new System.Windows.Forms.NotifyIcon();

            System.Windows.Forms.ContextMenuStrip cm = new System.Windows.Forms.ContextMenuStrip();

            cm.Items.Add(AppStrings.LabelLogs, null, (s, e) => LaunchDirectory(server.Config.Directories.Logs));
            cm.Items.Add(AppStrings.LabelPlugins, null, (s, e) => LaunchDirectory(server.Config.Directories.Plugins));
            cm.Items.Add(new ToolStripSeparator());
            cm.Items.Add(AppStrings.LabelClose, null, (s, e) => ForceClose());

            icon.ContextMenuStrip = cm;
            icon.MouseClick      += (s, args) => {
                if (args.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    if (Visibility == Visibility.Hidden)
                    {
                        this.ForceShow();
                    }

                    else
                    {
                        this.Hide();
                    }
                }
            };

            using var stream = System.Windows.Application.GetResourceStream(
                      new Uri("/Zorbo.Server.WPF;component/Zorbo.ico", UriKind.Relative)).Stream;

            if (stream != null)
            {
                icon.Icon = new System.Drawing.Icon(stream);
            }

            icon.Visible = true;

            server.PluginHost.LoadPlugin("Autoload");

            if (server.Config.AutoStartServer)
            {
                server.Start();
            }
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            icon = new System.Windows.Forms.NotifyIcon();

            System.Windows.Forms.ContextMenu cm = new System.Windows.Forms.ContextMenu();
            cm.MenuItems.Add("Close", (s, a) => { ForceClose(); });

            icon.ContextMenu = cm;
            icon.Click      += (s, args) => {
                if (Visibility == Visibility.Hidden)
                {
                    this.ForceShow();
                }

                else
                {
                    this.Hide();
                }
            };

            var stream = Application.GetResourceStream(
                new Uri("/Zorbo.UI;component/Zorbo.ico", UriKind.Relative)).Stream;

            if (stream != null)
            {
                icon.Icon = new System.Drawing.Icon(stream);
            }

            icon.Visible = true;

            server.PluginHost.LoadPlugin("Autoload");

            if (((Config)server.Config).AutoStartServer)
            {
                server.Start();
            }
        }