public WorkSpaceControl(OpenALPRViewItemManager viewItemManager)
        {
            _themeChangedReceiver = EnvironmentManager.Instance.RegisterReceiver(new MessageReceiver(ThemeChangedIndicationHandler),
                                                                                 new MessageIdFilter(MessageId.SmartClient.ThemeChangedIndication));

            InitializeComponent();

            ClientControl.Instance.RegisterUIControlForAutoTheming(this);

            lsvBookmarks.BackColor = ClientControl.Instance.Theme.BackgroundColor;
            lsvBookmarks.ForeColor = ClientControl.Instance.Theme.TextColor;

            var fullDateTimePattern = CultureInfo.CurrentCulture.DateTimeFormat.FullDateTimePattern;

            datStartTime.CustomFormat = fullDateTimePattern;
            datEndTime.CustomFormat   = fullDateTimePattern;

            datStartTime.Value = DateTime.Now.AddDays(-2);
            datEndTime.Value   = DateTime.Now.AddDays(1);

            chkMyBookmarksOnly.Checked = OpenALPRBackgroundPlugin.MyOwnBookmarksOnly;
            txtSearchFor.Text          = OpenALPRBackgroundPlugin.SearchString;
            if (OpenALPRBackgroundPlugin.Bookmarks != null)
            {
                AddToListView(OpenALPRBackgroundPlugin.Bookmarks);
            }

            var savedCameraId = Settings1.Default.usedFQID;

            if (savedCameraId != Guid.Empty)
            {
                var camera = Configuration.Instance.GetItem(EnvironmentManager.Instance.MasterSite.ServerId, savedCameraId, Kind.Camera);
                if (camera != null)
                {
                    txtCameraName.Text = camera.Name;
                    selectedCameraItem = camera;
                }
            }

            OpenALPRBackgroundPlugin.ServiceEvent += OpenALPRBackgroundPlugin_ServiceEvent;
        }
예제 #2
0
        public WorkSpaceControl(OpenALPRViewItemManager viewItemManager)
        {
            _themeChangedReceiver = EnvironmentManager.Instance.RegisterReceiver(new MessageReceiver(ThemeChangedIndicationHandler),
                                                                                 new MessageIdFilter(MessageId.SmartClient.ThemeChangedIndication));

            InitializeComponent();

            ClientControl.Instance.RegisterUIControlForAutoTheming(this);

            lsvBookmarks.BackColor = ClientControl.Instance.Theme.BackgroundColor;
            lsvBookmarks.ForeColor = ClientControl.Instance.Theme.TextColor;

            string fullDateTimePattern = CultureInfo.CurrentCulture.DateTimeFormat.FullDateTimePattern;

            datStartTime.CustomFormat = fullDateTimePattern;
            datEndTime.CustomFormat   = fullDateTimePattern;

            datStartTime.Value = DateTime.Now.AddDays(-2);
            datEndTime.Value   = DateTime.Now.AddDays(1);

            chkMyBookmarksOnly.Checked = OpenALPRBackgroundPlugin.MyOwnBookmarksOnly;
            txtSearchFor.Text          = OpenALPRBackgroundPlugin.SearchString;
            if (OpenALPRBackgroundPlugin.Bookmarks != null)
            {
                AddToListView(OpenALPRBackgroundPlugin.Bookmarks);
            }

            Guid savedCameraId = Settings1.Default.usedFQID;

            if (savedCameraId != Guid.Empty)
            {
                Item camera = Configuration.Instance.GetItem(EnvironmentManager.Instance.MasterSite.ServerId, savedCameraId, Kind.Camera);
                if (camera != null)
                {
                    txtCameraName.Text = camera.Name;
                    selectedCameraItem = camera;
                }
            }

            try
            {
                string           path             = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                MilestoneVersion milestoneVersion = null;
                try
                {
                    milestoneVersion = JsonConvert.DeserializeObject <MilestoneVersion>(
                        File.ReadAllText($"{path}\\Service\\Milestone.json"));
                    lblMilestone.Text = $"License type: { milestoneVersion.Name }, Bookmarking: { (milestoneVersion.Bookmarking ? "enabled" : "disabled") }";
                    if (!milestoneVersion.Bookmarking || EnvironmentManager.Instance.MasterSite.ServerId.ServerType == ServerId.EnterpriseServerType)
                    {
                        lblMilestone.ForeColor = Color.Red;
                    }
                }
                catch
                {
                    lblMilestone.Text      = "Status: Doesn't logged in.";
                    lblMilestone.ForeColor = Color.Red;
                }
            }
            catch (Exception ex)
            {
                Logger.Log.Error(null, ex);
            }

            OpenALPRBackgroundPlugin.ServiceEvent += OpenALPRBackgroundPlugin_ServiceEvent;
        }