示例#1
0
        private void PrintForm_Load(object sender, EventArgs e)
        { 
            var inif = new INIFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\eXpressPrint\\config.ini");

            if (!string.IsNullOrEmpty(inif.Read("PRINT_OPT", "AUTO")))
            {
                if (inif.Read("PRINT_OPT", "AUTO").Equals("Y"))
                    PrintAndReturn(_PrintImage);
            }


            if (!string.IsNullOrEmpty(inif.Read("PRINT_SET", "COPIES")))
            {
                var arr = new ArrayList();
               
                arr.AddRange(inif.Read("PRINT_SET", "COPIES").Split(','));

                var sortedList = arr.Cast<string>().OrderBy(item => int.Parse(item));

                foreach (var item in sortedList)
                {
                    comboBoxNumOfCopies.Items.Add(item);
                }

                comboBoxNumOfCopies.Items.Insert(0,"--Select--");
                comboBoxNumOfCopies.SelectedIndex = 0;
            }
            
            formState.Maximize(this);
            txtNumberOfCopies.Focus();
        }
示例#2
0
        private void LoadSettings()
        {
            var inif = new INIFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\eXpressPrint\\config.ini");
            switch (inif.Read("Location_Settings", "Default_Location").ToUpper())
            {
                case "DBOX":
                    Mode = SearchMode.DropBox;
                    AccessToken = inif.Read("DROP_SET", "Access_Token");
                    DropBoxFolder = inif.Read("DROP_SET", "Drop_Folder").Trim()==""
                        ? "": inif.Read("DROP_SET", "Drop_Folder");
                    break;
                case "LOCAL":
                    Mode = SearchMode.Local;
                    LocalFolder = inif.Read("LOCAL_SET", "Local_Path");
                    break;
                default:
                     Mode = SearchMode.DropBox;
                    AccessToken = inif.Read("DROP_SET", "Access_Token");
                    DropBoxFolder = inif.Read("DROP_SET", "Drop_Folder").Trim()==""
                        ? "": inif.Read("DROP_SET", "Drop_Folder");
                        break;
            }

            if (!string.IsNullOrEmpty(inif.Read("Path_Settings", "BG_Path")))
            {
                if (inif.Read("Path_Settings", "BG_Path").Trim().ToUpper()!="NO_IMAGE")
                    GeneratePictureBox(Image.FromFile(inif.Read("Path_Settings", "BG_Path")));
            }

            txtPhotoId.Select();
        }
示例#3
0
        private void LoadConfig()
        {
            var inif = new INIFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\eXpressPrint\\config.ini");

            if (!string.IsNullOrEmpty(inif.Read("Path_Settings", "BG_Path")))
            {
                if (inif.Read("Path_Settings", "BG_Path").ToUpper().Equals("NO_IMAGE"))
                {
                    pictureBoxBackground.Image = Resources.noimage;
                    chkNoImage.Checked = true;
                    btnBackGroundImage.Enabled = false;
                }
                else
                {
                    pictureBoxBackground.Image = Image.FromFile(inif.Read("Path_Settings", "BG_Path"));
                    chkNoImage.Checked = false;
                    btnBackGroundImage.Enabled = true;
                }
            }


            if (!string.IsNullOrEmpty(inif.Read("Location_Settings", "Default_Location")))
            {
                if (Convert.ToString(inif.Read("Location_Settings", "Default_Location")).ToUpper().Equals("DBOX"))
                {
                    rdBtnDropBox.Checked = true;
                    groupDrop.Visible = true;
                    groupLocal.Visible = false;
                    rdBtnLocal.Checked = false;

                    if (!string.IsNullOrEmpty(inif.Read("DROP_SET", "Access_Token")))
                        txtAccessToken.EditValue = inif.Read("DROP_SET", "Access_Token");

                    if (!string.IsNullOrEmpty(inif.Read("DROP_SET", "Drop_Folder")))
                        txtDropBoxFolder.EditValue = inif.Read("DROP_SET", "Drop_Folder");

                    if (!string.IsNullOrEmpty(inif.Read("LOCAL_SET", "Local_Path")))
                        txtLocalPath.EditValue = inif.Read("LOCAL_SET", "Local_Path");

                }
                else if (Convert.ToString(inif.Read("Location_Settings", "Default_Location")).ToUpper().Equals("LOCAL"))
                {
                    rdBtnLocal.Checked = true;
                    groupLocal.Visible = true;
                    groupDrop.Visible = false;
                    rdBtnDropBox.Checked = false;

                    if (!string.IsNullOrEmpty(inif.Read("LOCAL_SET", "Local_Path")))
                        txtLocalPath.EditValue = inif.Read("LOCAL_SET", "Local_Path");

                    if (!string.IsNullOrEmpty(inif.Read("DROP_SET", "Access_Token")))
                        txtAccessToken.EditValue = inif.Read("DROP_SET", "Access_Token");

                    if (!string.IsNullOrEmpty(inif.Read("DROP_SET", "Drop_Folder")))
                        txtDropBoxFolder.EditValue = inif.Read("DROP_SET", "Drop_Folder");
                }

                if (!string.IsNullOrEmpty(inif.Read("PRINT_OPT", "AUTO")))
                {
                    if (inif.Read("PRINT_OPT", "AUTO").Equals("Y"))
                        chkAutoPrint.Checked = true;
                    else
                        chkAutoPrint.Checked = false;
                }
                     
            }


            if (!string.IsNullOrEmpty(inif.Read("PRINT_SET", "COPIES")))
            {

                var arr = new ArrayList();

                arr.AddRange(inif.Read("PRINT_SET", "COPIES").Split(','));

                var sortedList = arr.Cast<string>().OrderBy(item => int.Parse(item));

                foreach (var item in sortedList)
                {
                    checkedListBoxNumOfOptions.Items[item].CheckState = CheckState.Checked;
                }
 
            }
             
        }
示例#4
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            UpdateLabel("");

            if (string.IsNullOrEmpty(Convert.ToString(txtPhotoId.EditValue)))
            {
                XtraMessageBox.Show(this, "Please enter a valid photo id.", "Invalid Search",
                     MessageBoxButtons.OK,
                     MessageBoxIcon.Asterisk);
                 
                txtPhotoId.Select();
                return;
            }


            PrintImage = null;
            Query = (string)txtPhotoId.EditValue;

            switch (this.Mode){
                case SearchMode.DropBox:
                    var task = Task.Run((Func<Task>)MainForm.Run);
                        task.Wait();
                    break;
                case SearchMode.Local:
                    GetLocalSearch();
                    break;
                default:
                    var taskdefault = Task.Run((Func<Task>)MainForm.Run);
                    taskdefault.Wait();
                    break;
                     
            }


            if (PrintImage != null)
            {
                var inif = new INIFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\eXpressPrint\\config.ini");
                var mode = inif.Read("PRINT_OPT", "AUTO");

                if (mode.Equals("N"))
                {
                    var frmPrintForm = new PrintForm(PrintImage,txtPhotoId.EditValue.ToString());
                    frmPrintForm.Show();
                    this.Hide();
                }
                else
                {
                    if (PrintImage.Width < PrintImage.Height)
                        PrintPotrait(PrintImage);
                    else
                        Print(PrintImage);
                }
            }
            else
            {
                XtraMessageBox.Show(this,
                      "We are unable to find your photo at this time."+Environment.NewLine+
                       "Please email your event name and photo code to [email protected]","Not Found", 
                      MessageBoxButtons.OK, 
                      MessageBoxIcon.Asterisk);

                txtPhotoId.EditValue = null;
                txtPhotoId.Focus();
            }
             
        }
示例#5
0
        private void SaveIniFile(string bgImagePath)
        {
            var inif = new INIFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\eXpressPrint\\config.ini");
            inif.Write("Path_Settings", "BG_Path", bgImagePath);

            inif.Write("Location_Settings", "Default_Location", rdBtnDropBox.Checked? "DBOX":"LOCAL");

            inif.Write("DROP_SET", "Access_Token",
                !string.IsNullOrEmpty(Convert.ToString(txtAccessToken.EditValue))
                    ? txtAccessToken.EditValue.ToString()
                    : "");

            inif.Write("DROP_SET", "Drop_Folder",
                !string.IsNullOrEmpty(Convert.ToString(txtDropBoxFolder.EditValue))
                    ? "/" + txtDropBoxFolder.EditValue
                    : "");

            inif.Write("LOCAL_SET", "Local_Path",
                !string.IsNullOrEmpty(Convert.ToString(txtLocalPath.EditValue)) ? txtLocalPath.EditValue.ToString() : "");

            var numberOfCopies = checkedListBoxNumOfOptions.CheckedItems.Cast<CheckedListBoxItem>().Aggregate(string.Empty, (current, item) => current + (item.Value.ToString() + ","));

            if (!string.IsNullOrEmpty(numberOfCopies))
                numberOfCopies = numberOfCopies.Substring(0, numberOfCopies.Length - 1);

            inif.Write("PRINT_SET", "COPIES",numberOfCopies);

            if (chkAutoPrint.Checked)
                inif.Write("PRINT_OPT", "AUTO", "Y");
            else
                inif.Write("PRINT_OPT", "AUTO", "N");
            
            XtraMessageBox.Show("Saved, please restart the application.", "Settings Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }