Example #1
0
        private void ProcessDefinitionRequest(ulong sender, IMsg msg)
        {
            if (msg is ResearchDefinitionRequestMessage)
            {
                var response = new ResearchDefinitionValueMessage();
                foreach (var def in Definitions.Research)
                {
                    response.Definitions.Add(def.GetObjectBuilder());
                }
                var player = Core.Players.TryGetPlayerBySteamId(sender);
                var owner  = player == null ? null : _playerStates.GetValueOrDefault(player.SteamUserId);
                if (owner != null)
                {
                    response.ResearchIds    = new string[owner.ResearchStates.Count];
                    response.ResearchStates = new ResearchState[owner.ResearchStates.Count];
                    var i = 0;
                    foreach (var state in owner.ResearchStates)
                    {
                        response.ResearchStates[i] = state.State;
                        response.ResearchIds[i]    = state.Definition.Id;
                        i++;
                    }
                }

                SendMessage(sender, response);
            }
        }
        public WinFormsProgressFeedback([NotNull] ToolStripProgressBar progressBar,
                                        [NotNull] ToolStripStatusLabel statusLabel,
                                        bool showWaitCursor     = false,
                                        [CanBeNull] IMsg logger = null)
        {
            Assert.ArgumentNotNull(progressBar, nameof(progressBar));
            Assert.ArgumentNotNull(statusLabel, nameof(statusLabel));

            _progressBar = progressBar;
            _statusLabel = statusLabel;
            _logger      = logger;

            if (showWaitCursor)
            {
                _oldCursor = Cursor.Current;
                // Cursor.Current is the app level cursor
                Cursor.Current = Cursors.WaitCursor;
            }
            else
            {
                _oldCursor = null;
            }

            _oldProgressBarVisible = _progressBar.Visible;
            _progressBar.Visible   = true;

            _oldStatusLabelVisible = _statusLabel.Visible;
            _statusLabel.Visible   = true;
        }
Example #3
0
        public void SendMessage(ulong endpoint, IMsg msg)
        {
            var target = MyAPIGateway.Multiplayer == null || endpoint == MyAPIGateway.Multiplayer.MyId
                ? "local"
                : (Core.Players.TryGetPlayerBySteamId(endpoint)?.DisplayName ?? $"Steam64={endpoint}");

            Logger.Debug($"Sending {msg.GetType().Name} to {target}");
            if (MyAPIGateway.Multiplayer == null || endpoint == MyAPIGateway.Multiplayer.MyId)
            {
                NetworkMessageRecieved?.Invoke(endpoint, msg);
                return;
            }

            Utilities.Assert(MyAPIGateway.Multiplayer.IsServer || endpoint == MyAPIGateway.Multiplayer.ServerId,
                             "Endpoint must be server for clients, and a client for server");
            var data = MyAPIGateway.Utilities.SerializeToBinary(new MsgContainer
            {
                Sender  = MyAPIGateway.Multiplayer.MyId,
                Message = msg
            });

            if (MyAPIGateway.Multiplayer.IsServer)
            {
                MyAPIGateway.Multiplayer.SendMessageTo(MOD_COMM_ID, data, endpoint);
            }
            else
            {
                MyAPIGateway.Multiplayer.SendMessageToServer(MOD_COMM_ID, data);
            }
        }
Example #4
0
        /// <summary>
        /// 加载模块方法
        /// </summary>
        /// <param name="msg">加载进度</param>
        /// <param name="moduleMenus">模块的菜单</param>
        public void LoadModules(IMsg msg, MenuStrip moduleMenus)
        {
            try
            {
                //加载Dev组件
                ModuleLoadDevComponent loader = new ModuleLoadDevComponent();

                _Modules = loader.GetModuleList(); //从运行目录中搜索模块文件
                foreach (ModuleInfo m in _Modules) //枚举模块文件
                {
                    if (!loader.LoadModule(m))
                    {
                        continue;                        //加载失败,继续Load下一个模块
                    }
                    //当前模块是否分配了权限.(当前用户是否有这个模块的权限).
                    //没有权限继续Load下一个模块
                    if (!loader.CanAccessModule(SystemAuthentication.UserAuthorities))
                    {
                        loader.ClearAssemble();
                        continue;
                    }

                    _ModulesLoadSucceed.Add(loader.ModuleMainForm);             //保存已加载的模块

                    msg.UpdateMessage("正在加载:" + loader.GetCurrentModuleName()); //显示加载进度
                    loader.LoadGUI(_tabControlModules);                         //将模块的功能按钮容器集成到主窗体的TabControl内
                    loader.LoadMenu(moduleMenus);                               //加载模块的菜单,集成到主窗体的主菜单内
                    (loader.ModuleMainForm as Form).MdiParent = _MDIMainForm;   //模块的主窗体也作为一个子窗体, 设置父窗体.
                }

                GC.Collect();//加载模块消耗内存,及时回收部分内存
            }
            catch (Exception ex) { Msg.ShowException(ex); }
        }
Example #5
0
        public static void Validate(this IMsg msg)
        {
            // handle missing account number and/or sequence fields by querying blockchain for up-to-date values
            if (string.IsNullOrEmpty(msg.account_number) || string.IsNullOrEmpty(msg.sequence))
            {
                var account = Account.Query(msg.network, msg.address);
                msg.account_number = account.account_number;
                msg.sequence       = account.sequence;
            }

            // handle missing fee and/or gas
            if (string.IsNullOrEmpty(msg.fee))
            {
                msg.fee = msg.network.defaultFee;
            }
            if (string.IsNullOrEmpty(msg.gas))
            {
                msg.gas = msg.network.defaultGas;
            }

            // set null memo to empty string
            if (string.IsNullOrEmpty(msg.memo))
            {
                msg.memo = "";
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            Console.WriteLine($"My id is {int.Parse(args[1])}");
            CSharpClient client = new CSharpClient();

            client.OnReceive += delegate()
            {
                IMsg msg = client.Take();
                MessageToOneClient mm = msg.Content as MessageToOneClient;
                Console.WriteLine($"Message type::{msg.PacketType}");
                Console.WriteLine(mm);
            };
            Console.WriteLine("Connecting......");
            if (client.Connect("127.0.0.1", 7777))
            {
                Console.WriteLine("成功连接Agent.");
            }
            else
            {
                Console.WriteLine("连接Agent失败.");
            }


            MessageToServer mm = new MessageToServer();

            mm.PlayerID = int.Parse(args[1]);
            mm.TeamID   = int.Parse(args[0]);
            mm.JobType  = Communication.Proto.JobType.Job1;
            client.SendMessage(mm);

            Console.ReadLine();
            client.Stop();
            client.Dispose();
        }
Example #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            msg = WmsCommon.UdpClient.Ins.SendOutDb("A12345", "X1111");
            // textBox1.Text += "\r\n 出库信息:" + msg.strFrm;


            //if (textBox1.Text == "")
            //{
            //    MessageBox.Show("sorry,料号输入为空导致系统未找到胶盘,出库失败!","WMS Message");
            //}
            //else
            //{//发送
            //    try
            //    {
            //        ConnServer();
            //        label3.Visible = true;
            //        DialogResult ds = MessageBox.Show("入库指令发送成功,等待出盘...", "WMS Message");
            //        if (ds == DialogResult.OK)
            //        {
            //            this.Visible=false;
            //            Hand_In_Frm_2 in_Frm_2 = new Hand_In_Frm_2();

            //            in_Frm_2.ShowDialog();

            //        }

            //    }
            //    catch (Exception)
            //    {

            //        throw;
            //    }

            //}
        }
Example #8
0
        protected internal virtual string transMsg(dynamic msg)
        {
            //组装消息
            IMsg pMsg = (IMsg)msg;

            if (pMsg == null)
            {
                return(null);
            }

            string userName = pMsg.usrName + "" == "" ? pMsg.usrNameNick : pMsg.usrName;
            var    msgWx    = new
            {
                usrID     = pMsg.IsUserGroup ? "" : pMsg.usrID,
                usrName   = pMsg.IsUserGroup ? "" : userName,
                msgID     = pMsg.msgID,
                msgType   = pMsg.msgType.ToString(),
                msg       = pMsg.msg.Replace("\r", "※r※").Replace("\n", "※n※").Replace("\t", "※t※").Replace("\"", "※i※").Replace("/", "※h※").Replace("\\", "※h※"),
                groupID   = pMsg.IsUserGroup ? pMsg.groupID : "",
                groupName = pMsg.IsUserGroup ? userName : "",
                usrPlat   = pMsg.usrPlat == typeMsger.None ? "wx" : pMsg.usrPlat.ToString(),
                time      = pMsg.msgTime.Ticks
            };

            return(JsonConvert.SerializeObject(msgWx));
        }
 public void Process(IMsg msg)
 {
     if (gameObject.activeInHierarchy)
     {
         ProcessMessage(msg);
     }
 }
Example #10
0
        private void ProcessDefinitionValue(ulong sender, IMsg msg)
        {
            var value = msg as ResearchDefinitionValueMessage;

            if (value == null)
            {
                return;
            }
            SetUiHidden(true);
            Definitions.BeginLoading();
            foreach (var o in value.Definitions)
            {
                Definitions.Load(o);
            }
            Definitions.FinishLoading();
            if (value.ResearchStates != null && value.ResearchIds != null &&
                MyAPIGateway.Session.LocalHumanPlayer != null)
            {
                var owner = GetOrCreatePlayer(MyAPIGateway.Session.LocalHumanPlayer);
                for (var i = 0; i < value.ResearchIds.Length; i++)
                {
                    owner.PlayerResearchState(value.ResearchIds[i], true).State = value.ResearchStates[i];
                }
            }

            SetUiHidden(false);
        }
Example #11
0
        /// <summary>缓存消息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public virtual bool CacheMsg(dynamic msg, bool isFromRobot = false)
        {
            if (_IsBuffer == false)
            {
                return(false);
            }

            //组装消息
            IMsg pMsg = (IMsg)msg;

            if (pMsg == null)
            {
                return(false);
            }

            //缓存消息
            if (isFromRobot)
            {
                pMsg.IsFromRobot = true;
            }
            _MsgsBuffer.Add(pMsg);

            //保持缓存数量
            if (_NumsBuffer > 0 && _MsgsBuffer.Count > _NumsBuffer)
            {
                _MsgsBuffer.RemoveRange(_MsgsBuffer.Count, _MsgsBuffer.Count - _NumsBuffer);
            }
            return(true);
        }
Example #12
0
 public static void Error([NotNull] string title,
                          [NotNull] string message,
                          [CanBeNull] Exception e = null,
                          [CanBeNull] IMsg msg    = null)
 {
     Error(null, title, message, e, msg);
 }
Example #13
0
 public ShowProviderVM(IGetHospitals providerServices, IUpdateProvider providerUpdate, IMsg messager)
 {
     ProviderServices      = providerServices;
     ProviderUpdate        = providerUpdate;
     UpdateProviderCommand = new UpdateProviderCommand(ProviderUpdate, this);
     Messager = messager;
 }
Example #14
0
        /// <summary>
        /// Shows the error dialog.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="message">The message.</param>
        /// <param name="title">The title.</param>
        /// <param name="e">The exception.</param>
        /// <param name="msg">The message sink. Allows to log the error using the logger
        /// of the calling context.</param>
        public void ShowError(IWin32Window owner, string title, string message,
                              Exception e, IMsg msg)
        {
            Assert.ArgumentNotNullOrEmpty(title, nameof(title));
            Assert.ArgumentNotNullOrEmpty(message, nameof(message));

            if (msg == null)
            {
                msg = _msg;
            }

            // write to log
            if (e != null)
            {
                msg.Error(message, e);
            }
            else
            {
                msg.Error(message);
            }

            Show(owner,
                 MsgBase.ReplaceBreakTags(message), title,
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Error,
                 MessageBoxDefaultButton.Button1);
        }
Example #15
0
 private void Send(IMsg msg)
 {
     while (!_endpoint.Send(msg))
     {
         Thread.Sleep(TimeSpan.FromSeconds(3));//3 second sau thi chay lai
         LogTo.Error("loopback");
     }
 }
Example #16
0
 public static void Error([CanBeNull] IWin32Window owner,
                          [NotNull] string title,
                          [NotNull] string message,
                          [CanBeNull] Exception e = null,
                          [CanBeNull] IMsg msg    = null)
 {
     Service.ShowError(owner, title, message, e, msg);
 }
Example #17
0
 /// <summary>
 /// Builds a standard message from a msg that implements the IMsgParams interface
 /// </summary>
 /// <param name="msg"></param>
 /// <returns></returns>
 public static StdMsg BuildStdMsg(this IMsg msg)
 {
     if (msg.msgs != null)
     {
         return(StdMsg.Build(msg.msgs, msg));
     }
     return(StdMsg.Build(msg));
 }
Example #18
0
        private const string _failuretitle = "Attention";         // todo daro think of a better title. Warning? Ooops? Shit?

        public static void HandleError([NotNull] Exception exception,
                                       [CanBeNull] IMsg msg,
                                       [CanBeNull] string title = null)
        {
            Assert.ArgumentNotNull(exception, nameof(exception));

            HandleError(ExceptionUtils.FormatMessage(exception), exception, msg, title);
        }
Example #19
0
        protected override void ProcessMessage(IMsg msg)
        {
            OnEvent call;

            if (m_Events.TryGetValue(msg.msg_id, out call))
            {
                call(msg);
            }
        }
Example #20
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="strLocalIP">本地IP</param>
        /// <param name="localPort">本地端口</param>
        /// <param name="remoteIP">服务器IP</param>
        /// <param name="remotePort">服务器端口</param>
        /// <param name="vModForm">接收数据修改显示事件</param>
        /// <param name="vServerOnLine">修改服务器在线或否的事件</param>
        public UdpClient(string strLocalIP, int localPort,
                         string remoteIP, int remotePort, int vWorkStation,
                         Action <IMsg> vModForm,
                         Action <string, Color> vServerOnLine
                         )
        {
            if (Ins != null)
            {
                throw new Exception("对象已经存在");
            }
            //g_m = em;
            //FrmMain frmMain = g_m as FrmMain;
            E_ModForm      = vModForm;
            E_ServerOnLine = vServerOnLine;
            LocMsg         = new MsgBase()
            {
                DaType      = "BS",
                LocalIP     = strLocalIP,
                LocalPort   = localPort,
                RemoteIP    = remoteIP,
                RemotePort  = remotePort,
                WorkStation = vWorkStation
            };
            Frame.Ins.FrmMsg = LocMsg;

            this.localPort = localPort;
            remoteEP       = new IPEndPoint(IPAddress.Parse(remoteIP), remotePort);
            lock (this)
            {
                try
                {
                    udpSend = new System.Net.Sockets.UdpClient(localPort);
                }
                catch (Exception ex)
                {
                    throw ex;
                    //MessageBox.Show("本地端口" + localPort.ToString() + "已被占用!", "提示", MessageBoxButtons.OK);
                    //if (frmMain.IsHandleCreated)
                    //{
                    //    Environment.Exit(0);
                    //}
                    //return;
                }
            }
            udpSendState = new UdpState
            {
                ipEndPoint = remoteEP,
                udpClient  = udpSend
            };
            udpReceiveState = new UdpState
            {
                ipEndPoint = remoteEP,
                udpClient  = udpSend
            };
            readCallback    = new AsyncCallback(SendCallback);
            receiveCallback = new AsyncCallback(ReceiveCallback);
        }
Example #21
0
 private void Ins_E_ModForm(IMsg obj)
 {
     if (textBox2.InvokeRequired)
     {
         tBox2.Invoke(new Action <IMsg>(Ins_E_ModForm), obj);
         return;
     }
     tBox2.Text += "\r\n" + DateTime.Now.ToString() + "--" + obj.DaType + "--" + obj.strFrm;
 }
Example #22
0
        public RegisterVM(IMsg msg, IAuth auth, IRenav renav, IGetHospitals getProviderService)
        {
            Msg  = msg;
            Auth = auth;

            RegisterCommand    = new RegisterCommand(this, auth, renav);
            ViewLoginCommand   = new RenavCommand(renav);
            GetProviderService = getProviderService;
        }
Example #23
0
        /// <summary>
        /// 发送短信
        /// </summary>
        /// <param name="msg"></param>
        public void Send(IMsg msg)
        {
            // 验证计费信息

            // 数据持久化

            // 发送
            sendStrategy.Send(msg);
        }
Example #24
0
 public LoginVM(IAuth loginService, IMsg msg, IRenav renavHome, IRenav renavRegister)
 {
     LoginService        = loginService;
     Msg                 = msg;
     LoginCommand        = new LoginCommand(this, loginService, renavHome);
     ViewRegisterCommand = new RenavCommand(renavRegister);
     Email               = "*****@*****.**";
     Password            = "******";
 }
Example #25
0
        private void OnNetworkMessageRecieved(ulong steamId, IMsg msg)
        {
            var ctl = msg as PlayerResearchStateControlMsg;

            if (ctl == null)
            {
                return;
            }
            var player = Manager.Core.Players.TryGetPlayerBySteamId(steamId);

            if (player == null)
            {
                return;
            }
            var data     = Manager.GetOrCreatePlayer(player);
            var research = data?.PlayerResearchState(ctl.ResearchId, true);

            if (research == null)
            {
                return;
            }

            switch (ctl.RequestedState)
            {
            case ResearchState.NotStarted:
                if (research.State == ResearchState.InProgress)
                {
                    research.State = ResearchState.NotStarted;
                    return;
                }
                break;

            case ResearchState.InProgress:
                if (research.State == ResearchState.NotStarted)
                {
                    if (!research.Definition.Trigger.BranchesWithPrereqs(data.ResearchState, data.HasUnlocked)
                        .Any())
                    {
                        Logger.Error($"Player {player.DisplayName} requested to start an unstartable research");
                        return;
                    }
                    research.State = ResearchState.InProgress;
                    return;
                }
                break;

            // invalid operations:
            case ResearchState.Completed:
                break;

            case ResearchState.Failed:
                break;
            }
            Logger.Error(
                $"Player {player.DisplayName} requested a bad state {ctl.RequestedState} for {ctl.ResearchId} when already in start {research.State}");
        }
        private void OnMsg(ulong playerSteamId, IMsg msg)
        {
            var im = msg as PlayerInteractionUnlockedMsg;

            if (im == null)
            {
                return;
            }
            _pending.Enqueue(new KeyValuePair <ulong, PlayerInteractionUnlockedMsg>(playerSteamId, im));
        }
Example #27
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="vMsg">信息</param>
 public MsgPlatingInDb(IMsg vMsg)
 {
     DaType      = "BR";
     Buffer      = null;
     RemoteIP    = vMsg.RemoteIP;
     RemotePort  = vMsg.RemotePort;
     LocalIP     = vMsg.LocalIP;
     LocalPort   = vMsg.LocalPort;
     WorkStation = vMsg.WorkStation;
 }
Example #28
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="vMsg">信息</param>
 public MsgOutDb(IMsg vMsg)
 {
     DaType      = "CK";
     Buffer      = null;
     RemoteIP    = vMsg.RemoteIP;
     RemotePort  = vMsg.RemotePort;
     LocalIP     = vMsg.LocalIP;
     LocalPort   = vMsg.LocalPort;
     WorkStation = vMsg.WorkStation;
 }
Example #29
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="vMsg">信息</param>
 /// <param name="vIP">远程IP</param>
 /// <param name="vPort">远程端口</param>
 public MsgBase(IMsg vMsg, string vIP = "0.0.0.0", int vPort = 0)
 {
     DaType      = vMsg.DaType;
     Buffer      = null;
     RemoteIP    = vMsg.RemoteIP;
     RemotePort  = vMsg.RemotePort;
     LocalIP     = vIP;
     LocalPort   = vPort;
     WorkStation = vMsg.WorkStation;
 }
Example #30
0
 public override void SendMsg(IMsg msg)
 {
     if (msg.ManagerID == ManagerId)
     {
         Process(msg.EventID, msg);
     }
     else
     {
         QMsgCenter.Instance.SendMsg(msg);
     }
 }
Example #31
0
        private static int CompareMsgs(SortType sort, IMsg msg1, IMsg msg2)
        {
            if (msg1 == null && msg2 == null)
            {
                return(0);
            }

            if (msg1 == null)
            {
                return(-1);
            }

            if (msg2 == null)
            {
                return(1);
            }

            switch (sort)
            {
            case SortType.ByIdAsc:
                return(msg1.ID.CompareTo(msg2.ID));

            case SortType.ByIdDesc:
                return(msg2.ID.CompareTo(msg1.ID));

            case SortType.BySubjectAsc:
                return(msg1.Subject.CompareTo(msg2.Subject));

            case SortType.BySubjectDesc:
                return(msg2.Subject.CompareTo(msg1.Subject));

            case SortType.ByAuthorAsc:
                return(msg1.UserNick.CompareTo(msg2.UserNick));

            case SortType.ByAuthorDesc:
                return(msg2.UserNick.CompareTo(msg1.UserNick));

            case SortType.ByDateAsc:
                return(msg1.Date.CompareTo(msg2.Date));

            case SortType.ByDateDesc:
                return(msg2.Date.CompareTo(msg1.Date));

            case SortType.ByForumAsc:
                return(msg1.ForumID.CompareTo(msg2.ForumID));

            case SortType.ByForumDesc:
                return(msg2.ForumID.CompareTo(msg1.ForumID));

            default:
                throw new NotSupportedException(
                          "This sorting type " + sort + " is not supported");
            }
        }
Example #32
0
		private static IEnumerable<IMsg> Flatten(this IMsg root, IMsg startBeyond)
		{
			return Flatten(root).SkipWhile(msg => msg != startBeyond).Skip(1);
		}
Example #33
0
		private static void GetAllChildren(IMsg msg, ICollection<IMsg> list, bool onlyUnread)
		{
			if (!onlyUnread || msg.IsUnread)
				list.Add(msg);

			foreach (IMsg child in msg)
				GetAllChildren(child, list, onlyUnread);
		}
Example #34
0
		private static IMsg GetFilteredMsgList(
			IServiceProvider provider,
			IMsg iMsg,
			string filterText)
		{
			if (iMsg is Msg)
				return Msg.FilterFirstLevel(provider, (Msg)iMsg, filterText);

			return iMsg;
		}
Example #35
0
		private void DoExpandUnread(IMsg node)
		{
			if (node.HasRepliesUnread)
				_tgMsgs.ExpandNode(node);
			else
				_tgMsgs.CollapseNode(node);

			if (node.HasChildren)
				foreach (IMsg item in node)
					DoExpandUnread(item);
		}
Example #36
0
		private static bool IsMsgConformAttribute(IMsg msg, AttrType attrType)
		{
			switch (attrType)
			{
				case AttrType.Any:
					return true;
				case AttrType.Unread:
					return msg.IsUnread;
				case AttrType.Marked:
					return msg.Marked;
				case AttrType.UnreadAnswerToMe:
					return msg.IsUnread
						&& msg.Parent.UserID > 0
							&& msg.Parent.UserID == Config.Instance.SelfId;
			}

			return false;
		}
Example #37
0
        /// <summary>
        /// 加载模块方法
        /// </summary>
        /// <param name="msg">加载进度</param>
        /// <param name="moduleMenus">模块的菜单</param>
        public void LoadModules(IMsg msg, MenuStrip moduleMenus)
        {
            try
            {
                //加载Dev组件
                ModuleLoadDevComponent loader = new ModuleLoadDevComponent();

                _Modules = loader.GetModuleList();//从运行目录中搜索模块文件
                foreach (ModuleInfo m in _Modules) //枚举模块文件
                {
                    if (!loader.LoadModule(m)) continue; //加载失败,继续Load下一个模块

                    //当前模块是否分配了权限.(当前用户是否有这个模块的权限).
                    //没有权限继续Load下一个模块
                    if (!loader.CanAccessModule(SystemAuthentication.UserAuthorities))
                    {
                        loader.ClearAssemble();
                        continue;
                    }

                    _ModulesLoadSucceed.Add(loader.ModuleMainForm);//保存已加载的模块

                    msg.UpdateMessage("正在加载:" + loader.GetCurrentModuleName());//显示加载进度
                    loader.LoadGUI(_tabControlModules); //将模块的功能按钮容器集成到主窗体的TabControl内
                    loader.LoadMenu(moduleMenus); //加载模块的菜单,集成到主窗体的主菜单内
                    (loader.ModuleMainForm as Form).MdiParent = _MDIMainForm; //模块的主窗体也作为一个子窗体, 设置父窗体.
                }

                GC.Collect();//加载模块消耗内存,及时回收部分内存
            }
            catch (Exception ex) { Msg.ShowException(ex); }
        }
Example #38
0
        /// <summary>
        /// 初始化MDI主窗体,在登录窗体显示加载状态。
        /// </summary>
        /// <param name="splash">登录窗体上的进度显示组件</param>
        public void InitUserInterface(IMsg splash)
        {
            try
            {
                this.SuspendLayout();

                splash.UpdateMessage("正在初始化用户界面...");
                this._MdiToolbar = new DevBarRegister(this, this.barToolButtons);
                this.RegisterMdiButtons();

                splash.UpdateMessage("下载基础数据...");
                CommonData.GetCommonInfos(); //获取其它公共数据
                DataDictCache.RefreshCache();

                splash.UpdateMessage("正在初始化模块容器...");
                _ModuleContainer = (frmModuleContainer)MdiTools.OpenChildForm(this as IMdiForm, typeof(frmModuleContainer), null);
                _ModuleContainer.InitButtons();

                splash.UpdateMessage("正在加载模块...");
                _ModuleManager = new ModuleManager(this, _ModuleContainer.xtraTabControl1);//创建模块管理器
                _ModuleManager.LoadModules(splash, _moduleMenus); //加载可用模块

                splash.UpdateMessage("正在初始化用户权限...");
                SystemAuthentication.SetMenuAuthority(_moduleMenus);
                _ModuleManager.SetModuleSecurity(_moduleMenus);

                splash.UpdateMessage("正在加载工具栏(Toolbar)...");
                _ModuleManager.CreateToolButtons(barMainMenu, _moduleMenus);

                splash.UpdateMessage("正在加载导航面板(Navigator Panel)...");
                _ModuleManager.CreateNavBarButtons(this.navBarControl1, _moduleMenus, NavigatorStyle.BarContainer); //创建导航工具栏按钮

                splash.UpdateMessage("加载完毕.");

                this.ResumeLayout();
            }
            catch (Exception ex)
            { Msg.ShowException(ex); }
        }
Example #39
0
 /// <summary>
 /// 发送短信
 /// </summary>
 /// <param name="msg"></param>
 public void Send(IMsg msg)
 {
     Com.Yuantel.MobileMsg.DAL.ISend dal = Com.Yuantel.MobileMsg.DAL.DataAccess.CreateSend();
     dal.Send(msg);
 }