// Coerce the name to prevent validation errors
    public void UpdateName()
    {
        int    column = nameBox.CursorGetColumn();
        string name   = nameBox.GetText();

        string[] forebidden = new string[] {
            " ", "\\", "/", "?", "@", "#", "$", "%", "^", "&", "*", "(", ")",
            "-", "=", "+", "{", "}", "\'", "\"", "~", "`", "!", "|", "[", "]"
        };

        for (int i = 0; i < forebidden.Length; i++)
        {
            name = name.Replace(forebidden[i], "_");
        }

        if (name.Length > MaxNameLength)
        {
            name = name.Substring(0, MaxNameLength);
        }

        nameBox.SetText(name);
        nameBox.CursorSetColumn(column);
        config.fileName = name + ".adventure";

        if (SettingsDb.SaveExists(config.fileName))
        {
            nameLabel.SetText(NameLabelWarning);
        }
        else
        {
            nameLabel.SetText(NameLabelText);
        }
    }
Example #2
0
 public SettingsPage(SQLiteConnection connection_)
 {
     InitializeComponent();
     _connection    = connection_;
     _settings      = Database.Settings.GetTableData(_connection);
     BindingContext = _settings;
     loading        = false;
 }
Example #3
0
        private HomeModel GetCompanyModel()
        {
            var companyId   = UserHelper.GetLoggedOnUserCompanyId();
            var companyName = new SettingsDb(_config).GetCompanyName(companyId);

            return(new HomeModel {
                CompanyId = companyId, CompanyName = companyName
            });
        }
Example #4
0
        public IActionResult Index(int companyId)
        {
            var model    = new SettingsViewModel();
            var settings = new SettingsDb(_config).GetSettings(companyId);

            model.Settings = settings;


            return(View(model));
        }
Example #5
0
        public IActionResult CarViewList(int companyId)
        {
            var model             = new CarsViewModel();
            var cars              = new CarDb(_config).getCars(companyId);
            var companyNameFromDB = new SettingsDb(_config).GetCompanyName(companyId);

            model.Cars        = cars;
            model.companyName = companyNameFromDB;

            return(View(model));
        }
Example #6
0
        public SettingsDb StoreDetails()
        {
            var settings_ = new SettingsDb
            {
                FastAudit      = fastaudit.IsToggled,
                BlindAudit     = blindaudit.IsToggled,
                PriceLock      = pricelock.IsToggled,
                FrontCamera    = frontcamera.IsToggled,
                FastAuditEntry = fastauditentry.IsToggled
            };

            return(settings_);
        }
Example #7
0
    public void InitSettings()
    {
        SettingsDb db = SettingsDb.Init();

        masterVolume      = Util.ToFloat(db.SelectSetting("master_volume"));
        sfxVolume         = Util.ToFloat(db.SelectSetting("sfx_volume"));
        musicVolume       = Util.ToFloat(db.SelectSetting("music_volume"));
        userName          = db.SelectSetting("username");
        mouseSensitivityX = Util.ToFloat(db.SelectSetting("mouse_sensitivity_x"));
        mouseSensitivityY = Util.ToFloat(db.SelectSetting("mouse_sensitivity_y"));
        db.Close();
        Sound.RefreshVolume();
    }
    public void InitSettings()
    {
        SettingsDb db = new SettingsDb();

        masterVolume      = Util.ToFloat(db.SelectSetting("master_volume"));
        sfxVolume         = Util.ToFloat(db.SelectSetting("sfx_volume"));
        musicVolume       = Util.ToFloat(db.SelectSetting("music_volume"));
        userName          = db.SelectSetting("username");
        mouseSensitivityX = Util.ToFloat(db.SelectSetting("mouse_sensitivity_x"));
        mouseSensitivityY = Util.ToFloat(db.SelectSetting("mouse_sensitivity_y"));
        player1Device     = (DeviceManager.Devices)Util.ToInt(db.SelectSetting("player1_device"));

        Sound.RefreshVolume();
    }
    public static void SaveSettings()
    {
        SettingsDb db = new SettingsDb();

        db.StoreSetting("master_volume", "" + Session.session.masterVolume);
        db.StoreSetting("sfx_volume", "" + Session.session.sfxVolume);
        db.StoreSetting("music_volume", "" + Session.session.musicVolume);
        db.StoreSetting("mouse_sensitivity_x", "" + Session.session.mouseSensitivityX);
        db.StoreSetting("mouse_sensitivity_y", "" + Session.session.mouseSensitivityY);
        db.StoreSetting("username", Session.session.userName);
        db.StoreSetting("player1_device", "" + (int)Session.session.player1Device);
        GD.Print("Saving player device as " + (int)Session.session.player1Device);
        Sound.RefreshVolume();
    }
Example #10
0
    public static void SaveSettings()
    {
        SettingsDb db = SettingsDb.Init();

        db.StoreSetting("master_volume", "" + Session.session.masterVolume);
        db.StoreSetting("sfx_volume", "" + Session.session.sfxVolume);
        db.StoreSetting("music_volume", "" + Session.session.musicVolume);
        db.StoreSetting("mouse_sensitivity_x", "" + Session.session.mouseSensitivityX);
        db.StoreSetting("mouse_sensitivity_y", "" + Session.session.mouseSensitivityY);
        db.StoreSetting("username", Session.session.userName);

        db.Close();
        Sound.RefreshVolume();
    }
Example #11
0
        private void LoadAssetData()
        {
            if (Application.Current.Properties.ContainsKey("LastAssetID") && Application.Current.Properties["LastAssetID"] != null)
            {
                //get asset based on ID then assign it to list
                var IEnumAsset = Database.Assets.GetAssetDataByAssetIDInternal(_connection, Application.Current.Properties["LastAssetID"].ToString());
                if (Database.Settings.GetTableData(_connection).BlindAudit)
                {
                    AssetListView2.IsVisible   = true;
                    AssetListView.IsVisible    = false;
                    AssetListView2.ItemsSource = AssetClass.DbToAssetClass(IEnumAsset, _Names);
                }
                else
                {
                    AssetListView.IsVisible   = true;
                    AssetListView2.IsVisible  = false;
                    AssetListView.ItemsSource = AssetClass.DbToAssetClass(IEnumAsset, _Names);
                }
            }
            else
            {
                var _defaultAsset = new AssetClass
                {
                    AssetName                 = "Default Asset Name",
                    AuditStatusDisplay_       = _Names.AssetStatus,
                    Barcode                   = "Default Barcode",
                    QuantityDisplay_          = _Names.Quantity,
                    OriginalPartDisplay_      = _Names.OriginalPartNo,
                    UIDDisplay_               = _Names.Asset_UID,
                    AssetSerialNumberDisplay_ = _Names.SerialNo,
                    BarcodeDisplay_           = _Names.Barcode,
                    AssetJSON                 = new AssetJsonObject
                    {
                        AssetStatus    = "Default Asset Status",
                        Quantity       = 0,
                        OriginalPartNo = "00000000",
                        Asset_UID      = "Example UID",
                        AssetSerialNo  = "01010101",
                        Barcode        = "Default Barcode",
                        AuditStatus    = "RECON",
                    }
                };
                AssetListView.ItemsSource = new List <AssetClass> {
                    _defaultAsset
                };
            }


            SettingsData = Database.Settings.GetTableData(_connection);
        }
Example #12
0
        private void InitialDatabaseExecutions()
        {
            if (SettingsDbFileCreated)
            {
                new SettingsDb().UserSettings.SetDefaultSettings();
            }

            if (ReplaysDbFileCreated && !SettingsDbFileCreated)
            {
                var settingsDb = new SettingsDb();
                settingsDb.UserSettings.UserPlayerId      = 0;
                settingsDb.UserSettings.UserBattleTagName = string.Empty;
                settingsDb.UserSettings.UserRegion        = 0;
            }
        }
Example #13
0
    public static SettingsDb Init()
    {
        if (System.IO.File.Exists(DefaultFile))
        {
            //GD.Print(DefaultFile + " already exists. Connecting.");
            return(new SettingsDb());
        }
        //GD.Print(DefaultFile + " doesn't exist. Creating.");
        CreateFile(DefaultFile);
        SettingsDb db = new SettingsDb();

        db.CreateTables();
        db.InitSettings();
        db.PrintSettings();
        return(db);
    }
Example #14
0
 public AuditPage(SQLiteConnection connection_, string SiteID_ = null, string LocID_ = null, string SubLocID_ = null)
 {
     _connection = connection_;
     InitializeComponent();
     HeaderLabel.Text     = "Select the " + Names_.Site + ", " + Names_.Location + " and/or " + Names_.SubLocation + " where you are auditing assets.";
     SiteName.Text        = Names_.Site;
     LocationName.Text    = Names_.Location;
     SubLocationName.Text = Names_.SubLocation;
     settings             = Database.Settings.GetTableData(_connection);
     if (Application.Current.Properties.ContainsKey("AuditedSite") && Application.Current.Properties["AuditedSite"] != null)
     {
         LoadSites(Application.Current.Properties["AuditedSite"].ToString());
     }
     else
     {
         LoadSites();
     }
 }
Example #15
0
    public void InitControls()
    {
        savesList = new ItemList();
        AddChild(savesList);
        savesList.AllowRmbSelect = true;
        savesList.Connect("item_selected", this, nameof(SelectSave));
        savesList.Connect("item_activated", this, nameof(LoadSave));

        foreach (string save in SettingsDb.GetAllSaves("adventure"))
        {
            savesList.AddItem(save);
        }

        backButton = Menu.Button("back", Back);
        AddChild(backButton);

        loadButton = Menu.Button("load", Load);
        AddChild(loadButton);
    }
Example #16
0
        public IActionResult CarView(string licensePlate)
        {
            bool carExistsInDb = new CarDb(_config).carExists(licensePlate);

            if (carExistsInDb)
            {
                var model             = new CarViewModel();
                var newCar            = new CarDb(_config).getCar(licensePlate);
                var companyNameFromDB = new SettingsDb(_config).GetCompanyName(newCar.CompanyId);
                model.car         = newCar;
                model.companyName = companyNameFromDB;

                return(View(model));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
        public void Execute()
        {
            SettingsDb settingsDb = new SettingsDb();

            if (settingsDb.UserSettings.UserPlayerId > 0)
            {
                UserProfile profile = new UserProfile()
                {
                    UserBattleTagName = settingsDb.UserSettings.UserBattleTagName,
                    UserRegion        = settingsDb.UserSettings.UserRegion,
                };

                settingsDb.UserProfiles.CreateUserProfile(profile);
            }
            else
            {
                settingsDb.UserSettings.UserBattleTagName = string.Empty;
                settingsDb.UserSettings.UserRegion        = 0;
                settingsDb.UserSettings.UserPlayerId      = 0;
            }
        }
 public ImageCollector(List <string> pathlist, string artist)
 {
     _pathList  = pathlist;
     _artist    = artist.ToLower();
     _imagePath = SettingsDb.GetSetting("ImagePath", "_Images").ToString();
 }