private string GetNewImage()
        {
            IMessageBoxService _msgboxservice = new MessageBoxService();
            string             _exefolder     = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string             result         = _msgboxservice.OpenFileDlg("Select the file containing the customer's logo", true, false, "Logo Files(*.ICO; *.PNG; *.JPG; *.GIF)| *.ICO; *.PNG; *.JPG; *.GIF", null, _exefolder);

            _msgboxservice = null;
            return(result);
        }
Пример #2
0
        private void ExecuteOpenShower(object parameter)
        {
            //select shower from dialog
            IMessageBoxService _msgboxcommand = new MessageBoxService();
            string             _exefolder     = ConfigFileManager.GetLocalExePath();//  Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string             _filename      = _msgboxcommand.OpenFileDlg("Select Shower", true, false, "Shower Files(*." + Constants._showerfilenameext + ")| *." + Constants._showerfilenameext, null, _exefolder);

            _msgboxcommand = null;
            OpenSelectedShowerFile(_filename);
        }
Пример #3
0
        private void ExecuteAddImage(object parameter)
        {
            IMessageBoxService msg      = new MessageBoxService();
            string             filename = msg.OpenFileDlg("Select the file containing the customer's logo", true, false, "Logo Files(*.ICO; *.PNG; *.JPG)| *.ICO; *.PNG; *.JPG", string.Empty, null);

            msg = null;

            if (!string.IsNullOrEmpty(filename) && (Customer.ID > 0))
            {
                filename = Path.GetFileName(filename);
                // ((CorporationModel)parameter).Logo = File.ReadAllBytes(filename);

                Customer.IconFileName = filename;
                UpdateCustomerLogo(Customer.ID, filename);

                //if (((CorporationModel)parameter).LogoID == 0)
                //    AddCorporationLogo(((CorporationModel)parameter).ID, ((CorporationModel)parameter).Logo);
                //else
                //    UpdateCorporationLogo(((CorporationModel)parameter).LogoID, ((CorporationModel)parameter).Logo);
            }
        }
Пример #4
0
        private void AddPhoto(object parameter)
        {
            IMessageBoxService msg      = new MessageBoxService();
            string             filename = msg.OpenFileDlg("Select the file containing the asset's photo", true, false, "Asset Photos(*.PNG; *.JPG)| *.PNG; *.JPG", string.Empty, null);

            if (!string.IsNullOrEmpty(filename) && !string.IsNullOrWhiteSpace(filename))
            {
                FileInfo fi = new FileInfo(filename);
                if (fi.Length > Defaults.MaxPhotoSize)
                {
                    msg.ShowMessage("The photo file size is too large (" + (Defaults.MaxPhotoSize / 1000).ToString() + " kB)", "Photo Size", GenericMessageBoxButton.OK, GenericMessageBoxIcon.Information);
                }
                else
                {
                    //PhotoModel Photo = new PhotoModel(){ ID = 0, AssetID = Asset.ID, Photo = File.ReadAllBytes(filename), PhotoFileName = filename };

                    filename = Path.GetFileName(filename);

                    PhotoModel Photo = new PhotoModel()
                    {
                        ID = 0, AssetID = Asset.ID, PhotoFileName = filename
                    };

                    Photo.ID = SQLiteQueries.AddPhoto(Photo);

                    if (Photo.ID > 0)
                    {
                        Photos.Add(Photo);
                        SelectedPhotoIndex = Photos.Count - 1;
                    }
                }
            }
            else
            {
                //not added
            }
        }