Exemple #1
0
        public static BlockPosData Parse(PosParameters pos)
        {
            var posData = new BlockPosData
            {
                Flags           = pos.Flags.ToString(),
                Mint            = pos.Mint,
                ProofHash       = pos.HashProof.ToString(),
                StakeModifier   = pos.StakeModifier.ToString(),
                StakeModifierV2 = pos.StakeModifierV2.ToString(),
                StakeTime       = pos.StakeTime
            };


            return(posData);
        }
Exemple #2
0
        public static SavedPosParameters FromPosParameters(PosParameters pos)
        {
            var posParams = new SavedPosParameters
            {
                HashProof       = pos.HashProof.ToString(),
                Mint            = pos.Mint,
                Flags           = (int)pos.Flags,
                StakeModifier   = pos.StakeModifier,
                StakeModifierV2 = pos.StakeModifierV2.ToString(),
                StakeTime       = pos.StakeTime,
                PrevoutStake    = SavedOutPoint.FromOutPoint(pos.PrevoutStake)
            };

            return(posParams);
        }
        public void InitializePos()
        {
            //Enable Logging
            Logger.Enabled = true;


            //Check database connection

            //  try
            //  {
            //Load Organization
            Logger.Info(this.GetType().FullName, this.GetType().FullName + "Reading Organization", PosSettings.Default.Debug);
            Organization organization = new Organization();

            organization.Organization_no = PosSettings.Default.Organization;
            organization.LoadByOrganizationNo();
            PosContext.Instance.Organization = organization;


            Logger.Info(this.GetType().FullName, this.GetType().FullName + "Reading PosConfig", PosSettings.Default.Debug);

            PosConfig posConfig = new PosConfig();

            posConfig.ConfigNo = PosSettings.Default.Configuration;
            posConfig.LoadByConfigNo();

            //Load configuration setting via PocConfig
            posConfig.Organization_id = PosSettings.Default.Organization;
            posConfig.Relations();

            //Cash the config code in the PosContext
            PosContext.Instance.Config = posConfig;

            //Load parameter setting;
            PosParameters parms = new PosParameters(PosContext.Instance.Config.ConfigNo);

            PosContext.Instance.Parameters = parms;

            Application.Current.MainWindow.FontFamily = new FontFamily(PosContext.Instance.Parameters.getParam("FontFamily"));

            //Retatil store group
            RetailStore retailStore = new RetailStore();

            retailStore.Retail_store_no = PosSettings.Default.Store;
            retailStore.Organization_no = PosSettings.Default.Organization;
            retailStore.Load();

            // Store RetailStore object in PosContext for easy reference
            PosContext.Instance.RetailStore = retailStore;

            // }
            // catch (Exception e)
            // {
            //     Logger.Error(this.GetType().FullName, e.StackTrace, e);
            //     MessageBox.Show("Please setup data source" + "\n" + e.ToString());
            //     PosHardware.Instance.Close();
            //     Application.Current.Shutdown();
            //     return;
            // }



            //Load panel classes
            //	this.progressView.SetProgressStep(50, "Loading menus");
            this.LoadPanels();


            //End
            //		this.progressView.SetProgressStep(100, "Loading Startup events");
            this.InitDisplay();


            //Pos Explorer
            try
            {
                //PropertyInfo info = this.GetType().FullName
                Logger.Info(this.GetType().FullName, this.GetType().FullName + ":" + "Creating PosExplorer", PosSettings.Default.Debug);
                PosContext.Instance.PosExplorer = new PosExplorer();

                Logger.Info(this.GetType().FullName, this.GetType().FullName + ":" + "Initilizing POS Hardware", PosSettings.Default.Debug);
                PosHardware.Instance.Initialize();
            }
            catch (Exception e)
            {
                Logger.Error(this.GetType().FullName, e.ToString(), e);
            }


            this.status = true;
        }