Ejemplo n.º 1
0
 public void Initialize()
 {
     server             = new Server("1.2.3.4", 5678);
     clock              = new MockClock();
     clock.CurrentTime += TimeSpan.FromSeconds(100);
     masterServerClient = new MockClient();
     serverInfoClient   = new MockClient();
     clientFactory      = new MockClientFactory(masterServerClient);
     clientFactory.AddClient(serverInfoClient);
     monitor = new DayZServerMonitorCore.Monitor(clock, clientFactory, new MockLogger());
     source  = new CancellationTokenSource();
 }
Ejemplo n.º 2
0
        public DayZServerMonitorForm()
        {
            InitializeComponent();

            contextMenu.MenuItems.Add("Add &Server...", AddServer_Click);
            contextMenu.MenuItems.Add("Add &Profile Location...", AddProfile_Click);
            removeSelectedServer = contextMenu.MenuItems.Add(
                "&Remove Selected Server", RemoveServer_Click);
            contextMenu.MenuItems.Add("-");
            contextMenu.MenuItems.Add("View &Logs", ViewLogs_Click);
            contextMenu.MenuItems.Add("-");
            contextMenu.MenuItems.Add("&Mini Window", MiniWindow_Click);
            contextMenu.MenuItems.Add("-");
            contextMenu.MenuItems.Add("S&ettings...", Settings_Click);

            settings.SettingChanged += Settings_SettingChanged;

            logViewer = new LogViewer(settings);
            logger    = new Logger(settings, clock, StatusWriter, logViewer.Add);
            monitor   = new DayZServerMonitorCore.Monitor(clock, clientFactory, logger);

            LoadSettings();

            SelectionCombo.DisplayMember = "DisplayName";
            SelectionCombo.ValueMember   = "Value";
            serverList = new ServerSelectionList(SelectionCombo, logger);
            RestoreSavedServers();
            SelectionCombo.SelectedValueChanged += new EventHandler(ServerSelectionChanged);

            this.SuspendLayout();
            this.miniLabel.Hide();
            this.miniLabel.Dock         = DockStyle.None;
            this.miniLabel.Location     = new Point(-32, -32);
            this.miniLabel.Size         = new Size(128, 128);
            this.miniLabel.BackColor    = Color.Black;
            this.miniLabel.ForeColor    = Color.White;
            this.miniLabel.Font         = new Font(FontFamily.GenericSansSerif, 24, FontStyle.Bold);
            this.miniLabel.TextAlign    = ContentAlignment.MiddleCenter;
            this.miniLabel.Padding      = new Padding(0);
            this.miniLabel.Margin       = new Padding(0);
            this.miniLabel.DoubleClick += MiniLabel_DoubleClick;
            this.miniLabel.MouseDown   += MiniLabel_MouseDown;
            this.miniLabel.MouseUp     += MiniLabel_MouseUp;
            this.miniLabel.MouseMove   += MiniLabel_MouseMove;
            this.Controls.Add(this.miniLabel);
            this.ResumeLayout();
        }