Пример #1
0
        private void _save_Click(object sender, EventArgs e)
        {
            if (_fileName == null)
            {
                using (var form = new SaveForm())
                {
                    form.Path = Path.Combine(_directory, "Report.wqreport");
                    if (form.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }

                    _fileName = Path.GetFileName(form.Path);

                    Text += " - " + _fileName;
                }
            }

            var report = new ReportDefinition
            {
                Entity = _entity
            };

            report.Filters.AddRange(_filters);

            report.Fields.AddRange(_columns.GetFields());
            report.Fields.AddRange(_rows.GetFields());
            report.Fields.AddRange(_values.GetFields());

            report.Save(Path.Combine(_directory, _fileName));
        }
Пример #2
0
 public void Save()
 {
     SaveForm?.Invoke(this, new PowerThreadNodeSaveFormEventArgs()
     {
         Entity = BindingViewModel
     });
 }
Пример #3
0
 public void CreateNewPatientForm()
 {
     FormName.SendKeys(Constant.fieldName);
     utility.ClickDropdownAndEnter(FormSelectDepartment);
     utility.ClickDropdownAndEnter(FormSelectCategory);
     FormTitle.SendKeys(Constant.fieldName);
     FillFormWithComponents();
     SaveForm.ClickOn();
     softAssert.VerifySuccessMsg();
 }
Пример #4
0
 public SaveResult(FileFinder _form, SaveForm _saveForm, Search _serach, string _fullName,
                   PageRange _pageRange)
 {
     this.saveForm  = _saveForm;
     this.form      = _form;
     this.lvStatus  = this.form.LVStatus;
     this.fullName  = _fullName;
     this.search    = _serach;
     this.pageRange = _pageRange;
     this.setpValue = 100 / (this.pageRange.End - this.pageRange.Begin + 2);
     this.lastValue = 100 - this.setpValue * (this.pageRange.End - this.pageRange.Begin + 1);
 }
Пример #5
0
        /// <summary>
        /// Constructeur par defaut
        /// </summary>
        public PrincipalForm()
        {
            InitializeComponent();
            SaveForm param_fenetre = Serializer.DeserialiserFenetre();

            if (param_fenetre != null)
            {
                this.Size = new System.Drawing.Size(param_fenetre.Weightform, param_fenetre.Heightform);
                this.splitContainer1.SplitterDistance = param_fenetre.Splitterdistance;
                this.Location = new System.Drawing.Point(param_fenetre.LocalisationX, param_fenetre.LocalisationY);
            }

            //initialisation de liaison avec le service
            client = new ServeurChat.ServeurChatSoapClient();
            //generation des clé pour la session qui va etre lance
            crypto      = new DSACryptoServiceProvider();
            securitykey = crypto.ExportParameters(false);
            connected   = false;
        }
Пример #6
0
        private void _save_Click(object sender, EventArgs e)
        {
            if (_fileName == null)
            {
                using (var form = new SaveForm())
                {
                    form.Path = Path.Combine(_directory, "Export.wqexport");
                    if (form.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }

                    _fileName = Path.GetFileName(form.Path);

                    Text += " - " + _fileName;
                }
            }

            BuildExport().Save(Path.Combine(_directory, _fileName));
        }
        public bool Save(bool showQuery)
        {
            if (SqlSourceType == SourceType.New)
            {
                SaveAsForm dialog = new SaveAsForm(Text);
                switch (dialog.ShowDialog())
                {
                case DialogResult.Cancel:
                    return(false);

                case DialogResult.No:
                    return(true);
                }
                if (dialog.SaveAsFile)
                {
                    return(SaveInFile());
                }
                return(SaveAsNewUserQuery());
            }
            if (_oldSql != FormattedQueryText)
            {
                if (showQuery)
                {
                    SaveForm saveDialog = new SaveForm();
                    if (saveDialog.ShowDialog() != DialogResult.OK)
                    {
                        return(false);
                    }
                    if (saveDialog.IsSave)
                    {
                        return(SaveQuery());
                    }
                }
                else
                {
                    return(SaveQuery());
                }
            }
            return(true);
        }
Пример #8
0
        private void StartButton_MouseUp(object sender, MouseEventArgs e)
        {
            EndTime           = DateTime.Now;
            MainTimer.Enabled = false;
            var span = EndTime - BeginTime;
            var rank = Query(span.TotalMilliseconds);

            if (rank == -1)
            {
                MessageBox.Show(this, "你的无聊程度未能进入前1000名。", "遗憾");
            }
            else
            {
                if (rank > 10)
                {
                    MessageBox.Show(this, string.Format("你的无聊程度排名为{0},未能上榜。", rank), "遗憾");
                }
                else
                {
                    var saveForm = new SaveForm(span.TotalMilliseconds);
                    saveForm.ShowDialog();
                }
            }
        }
Пример #9
0
        private void StoreRenamedFilesToSelectedDirectory()
        {
            SaveForm dialog = new SaveForm(tableController.ResultList);

            dialog.ShowDialog();
        }
Пример #10
0
        private void m_menuFileSaveAsBlocker_Click(object sender, EventArgs e)
        {
            SaveForm saveForm = new SaveForm(SaveForm.SaveType.SaveAsBlocker);

            saveForm.Show();
        }
Пример #11
0
        private void ButtonCloseTab_Click(object sender, EventArgs e)
        {
            SaveForm saveForm = new SaveForm(tabControl1, PictureList);

            saveForm.ShowDialog();
        }
Пример #12
0
        public ActionResult SaveFormData(SaveForm formData)
        {
            if (formData.SaveAllProperties == 0)
            {
                var getFormsPrintable = db.forms_printable.Where(x => x.PropertyID == formData.PropertyID && x.FormCreatorID == formData.FormCreatorID).FirstOrDefault();

                // Insert
                if (getFormsPrintable == null)
                {
                    if (formData.FormCreatorID == 2)
                    {
                        // Lease Agreement
                        var data1 = formData.Form.Substring(0, 64000);
                        var data2 = formData.Form.Substring(64001);

                        // First Data
                        forms_printable fp1 = new forms_printable();
                        fp1.Form          = data1;
                        fp1.FormCreatorID = 2;
                        fp1.PropertyID    = formData.PropertyID;
                        fp1.Form_Name     = "Lease_Agreement";
                        db.forms_printable.Add(fp1);
                        db.SaveChanges();

                        // Second Data
                        forms_printable fp2 = new forms_printable();
                        fp2.Form          = data2;
                        fp2.FormCreatorID = 2;
                        fp2.PropertyID    = formData.PropertyID;
                        fp2.Form_Name     = "Lease_Agreement";
                        db.forms_printable.Add(fp2);
                        db.SaveChanges();
                    }
                    else
                    {
                        forms_printable fp = new forms_printable();
                        // Get Form Name
                        var getFormName = db.formscreators.Where(x => x.FormsCreatorID == formData.FormCreatorID).FirstOrDefault();

                        fp.Form          = formData.Form;
                        fp.FormCreatorID = formData.FormCreatorID;
                        fp.PropertyID    = formData.PropertyID;
                        fp.Form_Name     = getFormName.FormName;
                        db.forms_printable.Add(fp);
                        db.SaveChanges();
                    }
                }
                // Update
                else
                {
                    if (formData.FormCreatorID == 2)
                    {
                        // Lease Agreement
                        var data1 = formData.Form.Substring(0, 64000);
                        var data2 = formData.Form.Substring(64001);

                        var getLeaseAgreement = db.forms_printable.Where(x => x.PropertyID == formData.PropertyID && x.FormCreatorID == 2).ToList();
                        int count             = 0;
                        foreach (var lease in getLeaseAgreement)
                        {
                            if (count == 0)
                            {
                                lease.Form = data1;
                                db.SaveChanges();
                            }
                            else
                            {
                                lease.Form = data2;
                                db.SaveChanges();
                            }
                            count++;
                        }
                    }
                    else
                    {
                        getFormsPrintable.Form = formData.Form;
                        db.SaveChanges();
                    }
                }
            }
            else
            {
                // All the Company Properties
                var companyID = (from p in db.properties
                                 where p.PropertyID == formData.PropertyID
                                 select new { p.CompanyID }).FirstOrDefault();

                var getProperties = db.properties.Where(p => p.CompanyID == companyID.CompanyID && p.Active == 0).ToList();
                foreach (var property in getProperties)
                {
                    int formsCreatorID = (int)formData.FormCreatorID;
                    // Get Form Name
                    var getFormName = db.formscreators.Where(x => x.FormsCreatorID == formData.FormCreatorID).FirstOrDefault();

                    // 12 defaults
                    if (formsCreatorID > 12)
                    {
                        var getFormsCreator = db.formscreators.Where(x => x.PropertyID == property.PropertyID && x.FormsCreatorID == formData.FormCreatorID).FirstOrDefault();
                        if (getFormsCreator == null)
                        {
                            formscreator fc = new formscreator();
                            fc.FormName   = getFormName.FormName;
                            fc.PropertyID = property.PropertyID;
                            db.formscreators.Add(fc);
                            db.SaveChanges();

                            formsCreatorID = fc.FormsCreatorID;
                        }
                        else
                        {
                            formsCreatorID = getFormsCreator.FormsCreatorID;
                        }
                    }

                    var getFormsPrintable = db.forms_printable.Where(x => x.PropertyID == property.PropertyID && x.FormCreatorID == formsCreatorID).FirstOrDefault();
                    if (getFormsPrintable == null)
                    {
                        if (formsCreatorID == 2)
                        {
                            // Lease Agreement
                            var data1 = formData.Form.Substring(0, 64000);
                            var data2 = formData.Form.Substring(64001);

                            // First Data
                            forms_printable fp1 = new forms_printable();
                            fp1.Form          = data1;
                            fp1.FormCreatorID = 2;
                            fp1.PropertyID    = property.PropertyID;
                            fp1.Form_Name     = "Lease_Agreement";
                            db.forms_printable.Add(fp1);
                            db.SaveChanges();

                            // Second Data
                            forms_printable fp2 = new forms_printable();
                            fp2.Form          = data2;
                            fp2.FormCreatorID = 2;
                            fp2.PropertyID    = property.PropertyID;
                            fp2.Form_Name     = "Lease_Agreement";
                            db.forms_printable.Add(fp2);
                            db.SaveChanges();
                        }
                        else
                        {
                            forms_printable fp = new forms_printable();

                            fp.Form          = formData.Form;
                            fp.FormCreatorID = formsCreatorID;
                            fp.PropertyID    = property.PropertyID;
                            fp.Form_Name     = getFormName.FormName;
                            db.forms_printable.Add(fp);
                            db.SaveChanges();
                        }
                    }
                    else
                    {
                        if (formsCreatorID == 2)
                        {
                            // Lease Agreement
                            var data1 = formData.Form.Substring(0, 64000);
                            var data2 = formData.Form.Substring(64001);

                            var getLeaseAgreement = db.forms_printable.Where(x => x.PropertyID == property.PropertyID && x.FormCreatorID == 2).ToList();
                            int count             = 0;
                            foreach (var lease in getLeaseAgreement)
                            {
                                if (count == 0)
                                {
                                    lease.Form = data1;
                                    db.SaveChanges();
                                }
                                else
                                {
                                    lease.Form = data2;
                                    db.SaveChanges();
                                }
                                count++;
                            }
                        }
                        else
                        {
                            getFormsPrintable.Form = formData.Form;
                            db.SaveChanges();
                        }
                    }
                }
            }

            System.Web.HttpContext.Current.Session["SelectedFormId"] = formData.FormCreatorID;
            return(Json(new { success = true }));
        }
Пример #13
0
        private List <byte[]> CreateNSBTXes(SaveForm SF)
        {
            List <byte[]> NSBTXes = new List <byte[]>();

            using (Py.GIL())
            {
                dynamic TexturePy = Python.Runtime.Py.Import("ndspy.texture");

                using (PyScope scope = Py.CreateScope())
                {
                    scope.Exec("import ndspy.texture");

                    for (int j = 0; j < 3; j++)
                    {
                        scope.Exec("nsbtx = ndspy.texture.NSBTX()");

                        for (int i = 0 + (255 * j); i < 255 + (255 * j); i++)
                        {
                            SF.SetMessage("Encoding Tile " + (i + 1) + " (Format: " + TextureFormats[i] + ")");

                            Console.WriteLine("Tex " + i);
                            Bitmap   TileBitmap = new Bitmap(16, 16);
                            Graphics g          = Graphics.FromImage(TileBitmap);
                            g.DrawImage(this.MainPNG, new Rectangle(new Point(0, 0), new Size(16, 16)), Helpers.GetRectangleForTileID(i), GraphicsUnit.Pixel);

                            EncodedImage Enc = null;

                            if (TextureFormats[i] == 7)
                            {
                                Enc = Images.EncodeImage_RGB555(TileBitmap);
                            }
                            else if (TextureFormats[i] == 5)
                            {
                                Enc = Images.Encode_Tex4x4(TileBitmap, 16);
                            }
                            else
                            {
                                PalettedImage p = Images.CreatePalettedImage(TileBitmap, this.TextureFormats[i]);
                                Enc = Images.EncodeImage(p, TextureFormats[i]);
                            }

                            string  Name = "Tile " + i.ToString();
                            dynamic Tex  = TexturePy.Texture.fromFlags(0, 0, true, true, false, false, TileBitmap.Width, TileBitmap.Height,
                                                                       this.TextureFormats[i], false, 0, 0x80010040, Enc.Texture, Enc.Texture2);
                            dynamic Pal = TexturePy.Palette.fromColors(0, 0, 0, Enc.Palette);

                            scope.Set("Name", Name.ToPython());
                            scope.Set("Tex", Tex);
                            scope.Set("Pal", Pal);
                            scope.Exec("nsbtx.textures.append((Name,Tex))");
                            scope.Exec("nsbtx.palettes.append((Name,Pal))");
                        }

                        scope.Exec("nsbtxf = nsbtx.save()");
                        NSBTXes.Add(scope.Get <byte[]>("nsbtxf"));
                    }
                }
            }

            return(NSBTXes);
        }
Пример #14
0
        public void Save(string Filename)
        {
            SaveForm SF = new SaveForm("...");

            SF.Show();

            string      JSONString = null;
            List <byte> UNTArray   = null;
            List <byte> UNTHDArray = null;

            byte[] CollisionsArray = null;

            Thread JSONCreation = new Thread(() =>
            {
                JSONString = CreateJSON();
            });

            JSONCreation.Start();

            Thread UNTCreation = new Thread(() =>
            {
                MakeUNTs(out UNTArray, out UNTHDArray);
            });

            UNTCreation.Start();

            Thread CollisionCreation = new Thread(() =>
            {
                CollisionsArray = MakeCollisions();
            });

            CollisionCreation.Start();

            SF.SetMessage("Creating NSBTXes...");

            List <byte[]> NSBTXes = CreateNSBTXes(SF);

            using (var NewZippedTileset = File.Create(Filename))
            {
                using (var ZipFile = new ZipArchive(NewZippedTileset, ZipArchiveMode.Create))
                {
                    SF.SetMessage("Saving NSBTX 1...");

                    ZipArchiveEntry Tex0File = ZipFile.CreateEntry(Textures[0]);

                    using (BinaryWriter Wr = new BinaryWriter(Tex0File.Open()))
                    {
                        Wr.Write(NSBTXes[0]);
                    }

                    SF.SetMessage("Saving NSBTX 2...");

                    ZipArchiveEntry Tex1File = ZipFile.CreateEntry(Textures[1]);

                    using (BinaryWriter Wr = new BinaryWriter(Tex1File.Open()))
                    {
                        Wr.Write(NSBTXes[1]);
                    }

                    SF.SetMessage("Saving NSBTX 3...");

                    ZipArchiveEntry Tex2File = ZipFile.CreateEntry(Textures[2]);

                    using (BinaryWriter Wr = new BinaryWriter(Tex2File.Open()))
                    {
                        Wr.Write(NSBTXes[1]);
                    }

                    SF.SetMessage("Saving Texture...");

                    ZipArchiveEntry ImageFile = ZipFile.CreateEntry("texture.png");

                    using (MemoryStream ms = new MemoryStream())
                    {
                        this.MainPNG.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

                        using (BinaryWriter Wr = new BinaryWriter(ImageFile.Open()))
                        {
                            byte[] PNG = ms.GetBuffer();
                            Wr.Write(PNG);
                        }
                    }

                    CollisionCreation.Join();

                    SF.SetMessage("Saving collision...");

                    ZipArchiveEntry CollisionsFile = ZipFile.CreateEntry("collisions.chk");

                    using (BinaryWriter Wr = new BinaryWriter(CollisionsFile.Open()))
                    {
                        Wr.Write(CollisionsArray);
                    }

                    UNTCreation.Join();

                    SF.SetMessage("Saving Objects...");

                    ZipArchiveEntry UNTFile = ZipFile.CreateEntry("objects.unt");

                    using (BinaryWriter Wr = new BinaryWriter(UNTFile.Open()))
                    {
                        Wr.Write(UNTArray.ToArray <byte>());
                    }

                    SF.SetMessage("Saving Object Headers...");

                    ZipArchiveEntry UNTHDFile = ZipFile.CreateEntry("objects.unthd");

                    using (BinaryWriter Wr = new BinaryWriter(UNTHDFile.Open()))
                    {
                        Wr.Write(UNTHDArray.ToArray <byte>());
                    }

                    JSONCreation.Join();

                    SF.SetMessage("Saving JSON...");

                    ZipArchiveEntry JSONFile = ZipFile.CreateEntry("meta.json");

                    using (StreamWriter Wr = new StreamWriter(JSONFile.Open()))
                    {
                        Wr.Write(JSONString);
                    }
                }
            }

            SF.Close();
        }
Пример #15
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
Start:
            #region LoginRegion
            using (var autoForm = new LoginForm())
            {
                if (autoForm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            #endregion

startChoice:
            #region CoustomMessageBox
            using (var question = new CustomMessageBox())
            {
                var dialogResult = question.ShowDialog();

                if (dialogResult == DialogResult.Yes)
                {
                    result = dialogResult.ToString();
                    question.Close();
                    goto end;
                }
                else if (dialogResult == DialogResult.No)
                {
                    result = dialogResult.ToString();
                    question.Close();
                    goto end;
                }
                else if (dialogResult == DialogResult.OK)
                {
                    result = dialogResult.ToString();
                    question.Close();
                    goto end;
                }
                else if (dialogResult == DialogResult.Abort)
                {
                    question.Close();
                    goto Start;
                }
            }
            #endregion

end:
            #region EndRegion
            switch (result)
            {
            case "Yes":
                using (var habrPars = new HabrParserForm())
                {
                    if (habrPars.ShowDialog() == DialogResult.Cancel)
                    {
                        habrPars.Close();
                        goto startChoice;
                    }
                }
                break;

            case "No":
                using (var agilityPars = new AgilityParserForm())
                {
                    if (agilityPars.ShowDialog() == DialogResult.Cancel)
                    {
                        agilityPars.Close();
                        goto startChoice;
                    }
                }
                break;

            case "OK":
                using (var saveData = new SaveForm())
                {
                    if (saveData.ShowDialog() == DialogResult.Cancel)
                    {
                        saveData.Close();
                        goto startChoice;
                    }
                }
                break;
            }
            #endregion
        }
Пример #16
0
        public void StoreFileList(List <Model.ResultTable> fileList)
        {
            SaveForm dialog = new SaveForm(fileList);

            dialog.ShowDialog();
        }
Пример #17
0
        /// <summary>
        /// Saves the medal data to a file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveButton_Click(object sender, EventArgs e)
        {
            string Profile = ProfileSelector.SelectedItem.ToString();

            // Show save dialog
            SaveForm Form = new SaveForm();
            if (Form.ShowDialog() != DialogResult.OK)
                return;

            // Add base medal data functions
            StringBuilder MedalData = new StringBuilder();
            StringBuilder MedalDataSF = new StringBuilder();
            MedalData.AppendLine(Utils.GetResourceAsString("BF2Statistics.MedalData.PyFiles.functions.py"));
            MedalData.AppendLine("medal_data = (");

            // Add Each Award (except ranks) to the MedalData Array
            foreach (Award A in AwardCache.GetBadges())
            {
                if (!Award.IsSfAward(A.Id))
                    MedalData.AppendLine("\t" + A.ToPython());
                else
                    MedalDataSF.AppendLine("\t" + A.ToPython());
            }

            foreach (Award A in AwardCache.GetMedals())
                MedalData.AppendLine("\t" + A.ToPython());

            foreach (Award A in AwardCache.GetRibbons())
            {
                if (!Award.IsSfAward(A.Id))
                    MedalData.AppendLine("\t" + A.ToPython());
                else
                    MedalDataSF.AppendLine("\t" + A.ToPython());
            }

            // Append Rank Data
            StringBuilder RankData = new StringBuilder();
            RankData.AppendLine(")" + Environment.NewLine + "rank_data = (");
            foreach (Rank R in AwardCache.GetRanks())
                RankData.AppendLine("\t" + R.ToPython());

            // Close off the Rank Data Array
            RankData.AppendLine(")#end");

            try
            {
                // Write to the Non SF file
                File.WriteAllText(
                    Path.Combine(PythonPath, "medal_data_" + Profile + ".py"),
                    (SaveForm.IncludeSFData)
                        ? MedalData.ToString() + MedalDataSF.ToString() + RankData.ToString().TrimEnd()
                        : MedalData.ToString() + RankData.ToString().TrimEnd()
                );

                // Write to the SF file
                File.WriteAllText(
                    Path.Combine(PythonPath, "medal_data_" + Profile + "_xpack.py"),
                    MedalData.ToString() + MedalDataSF.ToString() + RankData.ToString().TrimEnd()
                );

                // Update variables, and display success
                ChangesMade = false;
                Notify.Show("Medal Data Saved Successfully!", AlertType.Success);
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "An exception was thrown while trying to save medal data. Medal data has NOT saved."
                        + Environment.NewLine + Environment.NewLine
                        + "Message: " + ex.Message,
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                );
            }
        }
Пример #18
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveForm saveForm = new SaveForm();

            saveForm.ShowDialog();
        }