예제 #1
0
        public bool AddServer(string config, bool quiet = false)
        {
            // duplicate
            if (IsServerItemExist(config))
            {
                return(false);
            }

            var newServer = new Model.Data.ServerItem()
            {
                config = config,
            };

            lock (serverListWriteLock)
            {
                serverList.Add(newServer);
            }

            newServer.parent = this;
            BindEventsTo(newServer);

            if (!quiet)
            {
                newServer.UpdateSummaryThen(() =>
                {
                    InvokeEventOnRequireMenuUpdate(this, EventArgs.Empty);
                    InvokeEventOnRequireFlyPanelUpdate(this, EventArgs.Empty);
                });
            }

            LazyGC();
            LazySaveServerList();
            return(true);
        }
예제 #2
0
        public bool AddServer(string config, bool quiet = false)
        {
            var newServer = new Model.Data.ServerItem()
            {
                config = config,
            };

            lock (writeLock)
            {
                foreach (var server in this)
                {
                    if (server.config == config)
                    {
                        // duplicate
                        return(false);
                    }
                }

                this.Add(newServer);
            }

            BindEventTo(newServer);

            if (!quiet)
            {
                newServer.UpdateSummaryThen(() =>
                {
                    InvokeEventOnRequireMenuUpdate(this, EventArgs.Empty);
                    InvokeEventOnRequireFlyPanelUpdate(this, EventArgs.Empty);
                });
            }

            return(true);
        }