示例#1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="HACCP.Core.HomeViewModel" /> class.
        /// </summary>
        /// <param name="page">Page.</param>
        public HomeViewModel(IPage page)
            : base(page)
        {
            _onceLoaded = false;
            _dataStore  = new SQLiteDataStore();

            _haccpService = new HACCPService(_dataStore);
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="HACCP.Core.ServerSettingsConfirmationViewModel" /> class.
        /// </summary>
        /// <param name="page">Page.</param>
        /// <param name="_siteSettings">Site settings.</param>
        public ServerSettingsConfirmationViewModel(IPage page, SiteSettings _siteSettings) : base(page)
        {
            dataStore = new SQLiteDataStore();

            haccpService      = new HACCPService(dataStore);
            serverResetOption = 1; //default option: keep the pending recorded items, just pointed to new server.
            siteSettings      = _siteSettings;
        }
示例#3
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="HACCP.Core.WirelessTasksViewModel" /> class.
        /// </summary>
        /// <param name="page">Page.</param>
        public WirelessTasksViewModel(IPage page) : base(page)
        {
            onceLoaded   = false;
            dataStore    = new SQLiteDataStore();
            haccpService = new HACCPService(dataStore);

            checklists   = dataStore.GetCheckListResponses();
            temperatures = dataStore.GetItemTemperatures();
            if (temperatures != null && temperatures.Count > 0)
            {
                pendingTemperatureRecordsToUpload = true;
            }

            if (checklists != null && checklists.Count > 0)
            {
                pendingCheckListToUpload = true;
            }
            MessagingCenter.Subscribe <ProgressMessage>(this, HaccpConstant.UploadrecordMessage, sender =>
            {
                var message = sender;
                Progress    = message.UploadCount / (double)message.TotalCount;
            });

            MessagingCenter.Subscribe <UploadRecordRefreshMessage>(this, HaccpConstant.UploadRecordRefresh, sender =>
            {
                checklists   = dataStore.GetCheckListResponses();
                temperatures = dataStore.GetItemTemperatures();
                if (temperatures != null && temperatures.Count > 0)
                {
                    pendingTemperatureRecordsToUpload = true;
                }
                else
                {
                    pendingTemperatureRecordsToUpload = false;
                }

                if (checklists != null && checklists.Count > 0)
                {
                    pendingCheckListToUpload = true;
                }
                else
                {
                    pendingCheckListToUpload = false;
                }
            });
        }
示例#4
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="HACCP.Core.ServerSettingsViewModel" /> class.
        /// </summary>
        /// <param name="page">Page.</param>
        public ServerSettingsViewModel(IPage page)
            : base(page)
        {
            dataStore = new SQLiteDataStore();
            service   = new HACCPService(dataStore);


            ServerDirectory = HaccpConstant.DefultServerDirectyory;

            BindeAllLablelProperties();
            if (HaccpAppSettings.SharedInstance.SiteSettings.ServerAddress != null &&
                HaccpAppSettings.SharedInstance.SiteSettings.ServerAddress.Trim().Length > 0)
            {
                ServerAddress = HaccpAppSettings.SharedInstance.SiteSettings.ServerAddress;
                if (HaccpAppSettings.SharedInstance.SiteSettings.ServerPort != null)
                {
                    Port = HaccpAppSettings.SharedInstance.SiteSettings.ServerPort;
                }
                if (HaccpAppSettings.SharedInstance.SiteSettings.ServerDirectory != null)
                {
                    ServerDirectory = HaccpAppSettings.SharedInstance.SiteSettings.ServerDirectory;
                }
            }
        }
示例#5
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="HACCP.Core.MenuChecklistViewModel" /> class.
 /// </summary>
 /// <param name="page">Page.</param>
 public MenuChecklistViewModel(IPage page) : base(page)
 {
     dataStore       = new SQLiteDataStore();
     haccpService    = new HACCPService(dataStore);
     loadDataCommand = new Command(async() => await LoadMenuChecklists(), () => !IsBusy);
 }