示例#1
0
 void DisposeMyConfigureData()
 {
     if (configureData != null)
     {
         configureData = null;
     }
 }
示例#2
0
        void GenerateMyConfigureData()
        {
            object[] attributes = GetType().GetCustomAttributes(typeof(ConfigureDataAttribute), true);
            if (attributes.Length >= 1)
            {
#if UNITY_EDITOR
                if (attributes.Length > 1)
                {
                    if (LogUtil.ShowError != null)
                    {
                        LogUtil.ShowError(string.Format("模块[{0}]注册了多个配置数据模块,只有第一个会生效", GetType().Name));
                    }
                }
#endif
                ConfigureDataAttribute attribute = attributes[0] as ConfigureDataAttribute;
                Type configureDataType           = attribute.define;
                if (configureDataType != null && configureDataType.IsSubclassOf(typeof(ConfigureData)))
                {
                    configureData = (ConfigureData)Activator.CreateInstance(configureDataType);
                    //configureData = configureDataType.GetConstructor(Type.EmptyTypes).Invoke(null) as ConfigureData;
                }
#if UNITY_EDITOR
                else
                {
                    if (LogUtil.ShowError != null)
                    {
                        LogUtil.ShowError(string.Format("模块[{0}]注册的配置数据模块类型定义错误,配置数据模块类型需要从ConfigureData派生", GetType().Name));
                    }
                }
#endif
            }
        }
示例#3
0
 /// <summary>
 /// 判断程序是否改变了位置,并更新位置
 /// </summary>
 private void UpdateAutoOpen()
 {
     //如果程序地址/程序名变更
     if (ConfigureData.configure.EXEPath != Process.GetCurrentProcess().MainModule.FileName)
     {
         //如果是开机启动,需要重新设置
         if (ConfigureData.configure.isAutoOpen)
         {
             //删除原有的开机启动项
             SystemHelper.SetAutoRun(ConfigureData.configure.EXEPath, ConfigureData.configure.EXEName, false);
             //获得新的地址
             //程序地址
             string path = Process.GetCurrentProcess().MainModule.FileName;
             //程序名字
             string name = System.IO.Path.GetFileName(path);
             //重新设置新的开机启动项
             if (!SystemHelper.IsSetAutoRun(path, name))
             {
                 SystemHelper.SetAutoRun(path, name, true);
             }
         }
         //更新EXEPath和EXEName
         ConfigureData.configure.EXEPath = Process.GetCurrentProcess().MainModule.FileName;
         ConfigureData.configure.EXEName = System.IO.Path.GetFileName(ConfigureData.configure.EXEPath);
         //更新XML文档
         ConfigureData.SaveConfigure();
     }
 }
        //public MarketData Market { get; set; }

        public ConfigureMarketViewModel()
        {
            this.CloseWindowCommand     = new DelegateCommand <object>(this.Close);
            this.StartSimulationCommand = new DelegateCommand <object>(this.StartSimulation);

            this.ConfigureData = new ConfigureData();
            //this.Market = Market;
        }
示例#5
0
 /// <summary>
 /// 初始化
 /// </summary>
 public override void Init()
 {
     base.Init();
     //读取配置文件
     ConfigureData.LoadConfigure();
     //初始化开关
     InitSwitch();
     //查看开机启动项是否改变
     UpdateAutoOpen();
 }
示例#6
0
        /// <summary>
        /// 开机启动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="value"></param>
        private void uiSwitch_autoOpen_MouseClick(object sender, MouseEventArgs e)
        {
            //程序地址
            string path = Process.GetCurrentProcess().MainModule.FileName;
            //程序名字
            string name = System.IO.Path.GetFileName(path);

            //更新配置表
            ConfigureData.configure.isAutoOpen = uiSwitch_autoOpen.Active;
            ConfigureData.SaveConfigure();
            //设置程序是否自启动
            SystemHelper.SetAutoRun(path, name, uiSwitch_autoOpen.Active);
        }
示例#7
0
 /// <summary>
 /// 隐藏小图标
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="value"></param>
 private void uiSwitch_hideIcon_MouseClick(object sender, MouseEventArgs e)
 {
     ConfigureData.configure.isHideIcon = uiSwitch_hideIcon.Active;
     //更新XML文档
     ConfigureData.SaveConfigure();
 }