コード例 #1
0
        public MainForm(bool autoSync)
        {
            InitializeComponent();

            string fullyQualifiedName = Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
            string strAppDir          = Path.GetDirectoryName(fullyQualifiedName);

            _databaseFilePath = strAppDir + "\\ADAMobile.sdf";

            FileInfo fileInfo = new FileInfo(_databaseFilePath);

            if (fileInfo.Exists)
            {
                DateTime d = fileInfo.LastWriteTime;
                this.labelModifiedTime.Text = d.ToShortDateString() + " " + d.ToShortTimeString();
            }

            _connectionsCount = new SystemState(SystemProperty.ConnectionsCount);

            _connectionsCount.ComparisonType  = StatusComparisonType.GreaterOrEqual;
            _connectionsCount.ComparisonValue = 1;

            if (IsDeployed)
            {
                _connectionsCount.EnableApplicationLauncher("ADASync", fullyQualifiedName, "-EVENT");
            }
            else
            {
                _connectionsCount.DisableApplicationLauncher();
            }

            _connectionsCount2          = new SystemState(SystemProperty.ConnectionsCount);
            _connectionsCount2.Changed += new ChangeEventHandler(connectionsCount_Changed);

            cradlePresent          = new SystemState(SystemProperty.CradlePresent);
            cradlePresent.Changed += new ChangeEventHandler(connectionsCount_Changed);

            if (autoSync)
            {
                this.timerAutoSync.Enabled = true;
            }

            object syncTimeValue = this.Setting.LocalSetting.GetValue(REGISTRY_SYMBOL_LIBRARY_SYNC_TIME, null) as string;

            if (syncTimeValue != null)
            {
                DateTime d = Convert.ToDateTime(syncTimeValue);
            }

            syncTimeValue = this.Setting.LocalSetting.GetValue(REGISTRY_SCHEDULE_SYNC_TIME, null) as string;
            if (syncTimeValue != null)
            {
                DateTime d = Convert.ToDateTime(syncTimeValue);
                this.labelSyncTime.Text = d.ToShortDateString() + " " + d.ToShortTimeString();
            }

            this._deviceID = this.Setting.GlobalSetting.GetValue(REGISTRY_DEVICE_ID, null) as string;

            if (this._deviceID == null)
            {
                try
                {
                    this._deviceID = DeviceID.GetDeviceID();
                    this.Setting.GlobalSetting.SetValue(REGISTRY_DEVICE_ID, this._deviceID);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: nakijun/adasg
        public MainForm(bool autoSync)
        {
            InitializeComponent();

            string fullyQualifiedName = Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
            string strAppDir          = Path.GetDirectoryName(fullyQualifiedName);

            _databaseFilePath = strAppDir + "\\ADAMobile.sdf";

            FileInfo fileInfo = new FileInfo(_databaseFilePath);

            if (fileInfo.Exists)
            {
                DateTime d = fileInfo.LastWriteTime;
                this.labelModifiedTime.Text = d.ToShortDateString() + " " + d.ToShortTimeString();
            }

            _autoSyncEnabled = true;

            object autoSyncEnabled = this.Setting.LocalSetting.GetValue(REGISTRY_AUTO_SYNC_ENABLED, null);

            if (autoSyncEnabled != null)
            {
                _autoSyncEnabled = bool.Parse(autoSyncEnabled.ToString());
            }

            _connectionsCount = new SystemState(SystemProperty.ConnectionsCount);

            _connectionsCount.ComparisonType  = StatusComparisonType.GreaterOrEqual;
            _connectionsCount.ComparisonValue = 1;

            _connectionsCount2          = new SystemState(SystemProperty.ConnectionsCount);
            _connectionsCount2.Changed += new ChangeEventHandler(connectionsCount_Changed);

            _cradlePresent = new SystemState(SystemProperty.CradlePresent);
            _cradlePresent.ComparisonType  = StatusComparisonType.GreaterOrEqual;
            _cradlePresent.ComparisonValue = 1;

            _cradlePresent2          = new SystemState(SystemProperty.CradlePresent);
            _cradlePresent2.Changed += new ChangeEventHandler(connectionsCount_Changed);

            SetupApplicationLauncher();

            if (autoSync)
            {
                this.timerAutoSync.Enabled = true;
            }

            object syncTimeValue = this.Setting.LocalSetting.GetValue(REGISTRY_SYMBOL_LIBRARY_SYNC_TIME, null) as string;

            if (syncTimeValue != null)
            {
                DateTime d = Convert.ToDateTime(syncTimeValue);
            }

            syncTimeValue = this.Setting.LocalSetting.GetValue(REGISTRY_SCHEDULE_SYNC_TIME, null) as string;
            if (syncTimeValue != null)
            {
                DateTime d = Convert.ToDateTime(syncTimeValue);
            }

            syncTimeValue = this.Setting.LocalSetting.GetValue(REGISTRY_COMMUNICATOR_SYNC_TIME, null) as string;
            if (syncTimeValue != null)
            {
                DateTime d = Convert.ToDateTime(syncTimeValue);
                this.labelSyncTime.Text = d.ToShortDateString() + " " + d.ToShortTimeString();
            }

            this._deviceID = this.Setting.GlobalSetting.GetValue(REGISTRY_DEVICE_ID, null) as string;

            if (this._deviceID == null)
            {
                try
                {
                    this._deviceID = DeviceID.GetDeviceID();
                    this.Setting.GlobalSetting.SetValue(REGISTRY_DEVICE_ID, this._deviceID);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }

            _publisher   = (string)Setting.LocalSetting.GetValue("Server", "WIN2003");
            _internetUrl = string.Format("http://{0}/ADA/sqlcesa30.dll", _publisher);
        }