Example #1
0
        /***************************************************/

        public bool RunCommand(SaveAs command)
        {
            d_LusasData.saveAs(command.FileName);
            m_directory = new FileInfo(command.FileName).Directory.FullName;

            return(true);
        }
Example #2
0
        }     // Save

        private byte[] GetIconImageData(Bitmap image, SaveAs saveAs)
        {
            var estimatedCapacity = GetEstimatedIconImageSize(image);

            using (var output = new MemoryStream(estimatedCapacity))
            {
                if (saveAs == SaveAs.Auto)
                {
                    saveAs = (image.Width < 256) ? SaveAs.Bmp : SaveAs.Png;
                } // if

                switch (saveAs)
                {
                case SaveAs.Bmp:
                    GetIconImageBitmapData(output, image);
                    break;

                case SaveAs.Png:
                    image.Save(output, ImageFormat.Png);
                    break;
                } // switch saveAs

                output.Close();
                return(output.ToArray());
            } // using
        }     // GetIconImageData
Example #3
0
 public MyToDo(string str, DateTime time, int id, SaveAs save = SaveAs.Active)
 {
     ID         = id;
     Content    = str;
     CreateTime = time;
     Save       = save;
 }
 void Application_WorkbookAfterSave(Excel.Workbook Wb, bool Success)
 {
     if (Wb.FullName != CurrentFullName)
     {
         CurrentFullName = Wb.FullName;
         SaveAs.Invoke(null, null);
     }
 }
Example #5
0
        public void SaveAs()
        {
            if (!GetParent().Text.EndsWith("*"))
            {
                RemoteSource MemberInfo = (RemoteSource)this.Tag;
                if (MemberInfo != null)
                {
                    switch (MemberInfo.GetFS())
                    {
                    case FileSystem.QSYS:
                        if (!MemberInfo._IsBeingSaved)
                        {
                            SaveAs SaveAsWindow = new SaveAs();
                            SaveAsWindow.ShowDialog();
                            if (SaveAsWindow.Success)
                            {
                                MemberInfo._IsBeingSaved = true;

                                Editor.TheEditor.SetStatus("Saving " + SaveAsWindow.Mbr + "..");
                                Thread gothread = new Thread((ThreadStart) delegate
                                {
                                    bool UploadResult = IBMiUtils.UploadMember(MemberInfo.GetLocalFile(), SaveAsWindow.Lib, SaveAsWindow.Spf, SaveAsWindow.Mbr);
                                    if (UploadResult == false)
                                    {
                                        MessageBox.Show("Failed to upload to " + SaveAsWindow.Mbr + ".");
                                    }

                                    this.Invoke((MethodInvoker) delegate
                                    {
                                        Editor.TheEditor.SetStatus(SaveAsWindow.Mbr + " " + (UploadResult ? "" : "not ") + "saved.");
                                    });

                                    MemberInfo._IsBeingSaved = false;
                                });

                                gothread.Start();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Save as is not available for local source.");
                        }
                        break;

                    case FileSystem.IFS:
                        MessageBox.Show("Save as is not available for stream files yet.");
                        break;
                    }
                }
            }
            else
            {
                MessageBox.Show("You must save the source before you can Save-As.");
            }
        }
Example #6
0
 private void SaveBtn_Click(object sender, EventArgs e)
 {
     if (file_opened)
     {
         SaveToXml(file_name);
     }
     else
     {
         SaveAs.PerformClick();
     }
 }
        public StreamSaveDataGridView(LinkedList<Triangle> linkedList, string fileFolder, SaveAs saveAs)
        {
            if (saveAs.Equals(SaveAs.txt) || saveAs.Equals(SaveAs.None))
                LinkedListToString(linkedList, fileFolder);

            else if (saveAs.Equals(SaveAs.xml))
                LinkedListToXml(linkedList, fileFolder);

            else if (saveAs.Equals(SaveAs.html))
                LinkedListToHtml(linkedList, fileFolder);

            else throw new ArgumentException();
        }
Example #8
0
 public void CreateMainMenu(Gtk.Menu menu)
 {
     menu.Append(New.CreateAcceleratedMenuItem(Gdk.Key.N, Gdk.ModifierType.ControlMask));
     menu.Append(NewScreenshot.CreateMenuItem());
     menu.Append(Open.CreateAcceleratedMenuItem(Gdk.Key.O, Gdk.ModifierType.ControlMask));
     menu.Append(OpenRecent.CreateMenuItem());
     menu.AppendSeparator();
     menu.Append(Save.CreateAcceleratedMenuItem(Gdk.Key.S, Gdk.ModifierType.ControlMask));
     menu.Append(SaveAs.CreateAcceleratedMenuItem(Gdk.Key.S, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
     menu.AppendSeparator();
     menu.Append(Print.CreateAcceleratedMenuItem(Gdk.Key.P, Gdk.ModifierType.ControlMask));
     menu.AppendSeparator();
     menu.Append(Close.CreateAcceleratedMenuItem(Gdk.Key.W, Gdk.ModifierType.ControlMask));
     menu.Append(Exit.CreateAcceleratedMenuItem(Gdk.Key.Q, Gdk.ModifierType.ControlMask));
 }
Example #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XLSToCSVConverter"/> class.
        /// </summary>
        /// <param name="sourceFile">
        /// The path to the xls(b/x) being converted
        /// </param>
        /// <param name="importheader">
        /// Option to import the header row or not.
        /// </param>
        /// <param name="saveAs">
        /// The option to save the xls(x/b) as one csv file or a csv file per worksheet.
        /// </param>
        /// <param name="delimeter">
        /// The CSV file delimeter requried.
        /// </param>
        /// <param name="qualifier">
        /// The CSV file qualifier required.
        /// </param>
        public ExcelData(string sourceFile, ImportHeader importheader, SaveAs saveAs, char delimeter, char qualifier)
        {
            if (!File.Exists(sourceFile))
            {
                throw new FileNotFoundException(
                String.Format("The source file: {0} can not be found.", sourceFile));
            }

            this.IsSaveAs = saveAs;
            this.SourceFile = sourceFile;
            this.IsImportHeader = importheader;
            this.Delimeter = delimeter.ToString();
            this.Qualifier = qualifier.ToString();
            this.workSheets = new Dictionary<string, DataTable>();
        }
Example #10
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveAs.Filter = "Text files (*.txt)|*.txt";
            DialogResult result = SaveAs.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (!File.Exists(SaveAs.FileName))
                {
                    using (File.Create($"{SaveAs.FileName}"));
                }
                using (StreamWriter sr = new StreamWriter(SaveAs.FileName))
                    foreach (string lines in rctxbx_MainText.Lines)
                    {
                        sr.WriteLine(lines);
                    }
            }
        }
Example #11
0
        public void CreateMainMenu(Gtk.Menu menu)
        {
            menu.Append(New.CreateAcceleratedMenuItem(Gdk.Key.N, Gdk.ModifierType.ControlMask));
            menu.Append(NewScreenshot.CreateMenuItem());
            menu.Append(Open.CreateAcceleratedMenuItem(Gdk.Key.O, Gdk.ModifierType.ControlMask));
            menu.Append(OpenRecent.CreateMenuItem());
            menu.AppendSeparator();
            menu.Append(Save.CreateAcceleratedMenuItem(Gdk.Key.S, Gdk.ModifierType.ControlMask));
            menu.Append(SaveAs.CreateAcceleratedMenuItem(Gdk.Key.S, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
            menu.AppendSeparator();
            // Printing is disabled for now until it is fully functional.
#if false
            menu.Append(Print.CreateAcceleratedMenuItem(Gdk.Key.P, Gdk.ModifierType.ControlMask));
            menu.AppendSeparator();
#endif
            menu.Append(Close.CreateAcceleratedMenuItem(Gdk.Key.W, Gdk.ModifierType.ControlMask));
            menu.Append(Exit.CreateAcceleratedMenuItem(Gdk.Key.Q, Gdk.ModifierType.ControlMask));
        }
Example #12
0
        } // AllowNowSquareImages

        /// <summary>
        /// Adds an image to the Icon
        /// </summary>
        /// <param name="image">The image to add</param>
        /// <param name="saveAs">How the image will be stored within the icon file</param>
        /// <remarks>
        /// Only 32bpp ARGB images are supported. Therefore, the supplied image wil be converted to PixelFormat.Format32bppArgb
        /// This will cause ArgumentException to be thrown if two images of different bit depth are supplied for the same size
        /// </remarks>
        public void AddImage(Bitmap image, SaveAs saveAs = SaveAs.Auto)
        {
            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }
            if (!AllowNonSquareImages)
            {
                if ((image.Width != image.Height))
                {
                    throw new ArgumentOutOfRangeException(nameof(image), Texts.WindowsIcon_NonSquare);
                }
            } // if
            if (image.Width > 256)
            {
                throw new ArgumentOutOfRangeException(nameof(image), Texts.WindowsIcon_TooBig);
            }
            if (image.Width < 16)
            {
                throw new ArgumentOutOfRangeException(nameof(image), Texts.WindowsIcon_TooSmall);
            }

            // we only support 32bpp ARGB images; therefore, we need to convert the image to this format
            if (image.PixelFormat != PixelFormat.Format32bppArgb)
            {
                var newImage = To32BppArgbBitmap(image);
                image.Dispose();
                image = newImage;
            } // if

            // this code is retained for future enhancement
            var bitsPerPixel = GetBitsPerPixel(image.PixelFormat);

            if (bitsPerPixel > 32)
            {
                var newImage = To32BppArgbBitmap(image);
                image.Dispose();
                image = newImage;
            } // if

            // adding a duplicated image will throw ArgumentException
            _images.Add(new IconKind(image.Width, bitsPerPixel, saveAs), image);
        } // AddImage
Example #13
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(New, "<Primary>N");
            menu.AppendItem(New.CreateMenuItem());

            app.AddAction(NewScreenshot);
            menu.AppendItem(NewScreenshot.CreateMenuItem());

            app.AddAccelAction(Open, "<Primary>O");
            menu.AppendItem(Open.CreateMenuItem());

            var save_section = new GLib.Menu();

            menu.AppendSection(null, save_section);

            app.AddAccelAction(Save, "<Primary>S");
            save_section.AppendItem(Save.CreateMenuItem());

            app.AddAccelAction(SaveAs, "<Primary><Shift>S");
            save_section.AppendItem(SaveAs.CreateMenuItem());

            var close_section = new GLib.Menu();

            menu.AppendSection(null, close_section);

            app.AddAccelAction(Close, "<Primary>W");
            close_section.AppendItem(Close.CreateMenuItem());

            // This is part of the application menu on macOS.
            if (PintaCore.System.OperatingSystem != OS.Mac)
            {
                var exit = PintaCore.Actions.App.Exit;
                app.AddAccelAction(exit, "<Primary>Q");
                close_section.AppendItem(exit.CreateMenuItem());
            }

            // Printing is disabled for now until it is fully functional.
#if false
            menu.Append(Print.CreateAcceleratedMenuItem(Gdk.Key.P, Gdk.ModifierType.ControlMask));
            menu.AppendSeparator();
#endif
        }
Example #14
0
        public void SaveAs()
        {
            if (!GetParent().Text.EndsWith("*"))
            {
                SaveAs SaveAsWindow = new SaveAs();
                SaveAsWindow.ShowDialog();
                if (SaveAsWindow.Success)
                {
                    Member MemberInfo = (Member)this.Tag;
                    if (!MemberInfo._IsBeingSaved)
                    {
                        MemberInfo._IsBeingSaved = true;

                        Editor.TheEditor.SetStatus("Saving " + SaveAsWindow.Mbr + "..");
                        Thread gothread = new Thread((ThreadStart) delegate
                        {
                            bool UploadResult = IBMiUtils.UploadMember(MemberInfo.GetLocalFile(), SaveAsWindow.Lib, SaveAsWindow.Spf, SaveAsWindow.Mbr);
                            if (UploadResult == false)
                            {
                                MessageBox.Show("Failed to upload to " + SaveAsWindow.Mbr + ".");
                            }

                            this.Invoke((MethodInvoker) delegate
                            {
                                Editor.TheEditor.SetStatus(SaveAsWindow.Mbr + " " + (UploadResult ? "" : "not ") + "saved.");
                            });

                            MemberInfo._IsBeingSaved = false;
                        });

                        gothread.Start();
                    }
                }
            }
            else
            {
                MessageBox.Show("You must save the source before you can Save-As.");
            }
        }
Example #15
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            EntityReference Template        = DocumentTemplateId.Get(executionContext);
            Boolean         Logging         = EnableLogging.Get(executionContext);
            string          LicenseFilePath = LicenseFile.Get(executionContext);
            string          LogFilePath     = LogFile.Get(executionContext);
            bool            savePrimary     = SavePrimary.Get(executionContext);
            string          saveAs          = SaveAs.Get(executionContext);

            OutputAttachmentId.Set(executionContext, new EntityReference("annotation", Guid.Empty));
            try
            {
                if (Logging)
                {
                    Log("Workflow Executed", LogFilePath);
                }
                IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
                IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
                IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);
                string PrimaryEntityName = context.PrimaryEntityName;
                Guid   PrimaryEntityId   = context.PrimaryEntityId;
                try
                {
                    if (Logging)
                    {
                        Log("Enable Licensing", LogFilePath);
                    }
                    if (LicenseFilePath != "" && File.Exists(LicenseFilePath))
                    {
                        License Lic = new License();
                        Lic.SetLicense(LicenseFilePath);
                        if (Logging)
                        {
                            Log("License Set", LogFilePath);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log("Error while applying license: " + ex.Message, LogFilePath);
                }
                QueryExpression RetrieveNoteQuery = new QueryExpression("annotation");
                RetrieveNoteQuery.ColumnSet = new ColumnSet(new string[] { "subject", "documentbody" });
                RetrieveNoteQuery.Criteria.AddCondition(new ConditionExpression("objectid", ConditionOperator.Equal, Template.Id));
                if (Logging)
                {
                    Log("Executing Query to retrieve Template Attachment", LogFilePath);
                }
                EntityCollection Notes = service.RetrieveMultiple(RetrieveNoteQuery);
                if (Logging)
                {
                    Log("Attachment Retrieved Successfully", LogFilePath);
                }
                if (Notes.Entities.Count > 0)
                {
                    Entity Note     = Notes[0];
                    string FileName = "";
                    if (Note.Contains("filename"))
                    {
                        FileName = Note["filename"].ToString();
                    }
                    if (Note.Contains("documentbody"))
                    {
                        if (Logging)
                        {
                            Log("Attachment Read Successfully", LogFilePath);
                        }
                        byte[]       DocumentBody = Convert.FromBase64String(Note["documentbody"].ToString());
                        MemoryStream fileStream   = new MemoryStream(DocumentBody);
                        if (Logging)
                        {
                            Log("Reading Document in Aspose.Words", LogFilePath);
                        }
                        Document doc = new Document(fileStream);
                        if (Logging)
                        {
                            Log("Getting Fields list", LogFilePath);
                        }

                        string[] fields = doc.MailMerge.GetFieldNames();
                        if (Logging)
                        {
                            Log("Getting list of fields for entity", LogFilePath);
                        }
                        Entity PrimaryEntity = service.Retrieve(PrimaryEntityName, PrimaryEntityId, new ColumnSet(fields));
                        if (Logging)
                        {
                            Log("Retrieved Contact entity", LogFilePath);
                        }
                        if (PrimaryEntity != null)
                        {
                            string[] values = new string[fields.Length];
                            for (int i = 0; i < fields.Length; i++)
                            {
                                if (PrimaryEntity.Contains(fields[i]))
                                {
                                    if (PrimaryEntity[fields[i]].GetType() == typeof(OptionSetValue))
                                    {
                                        values[i] = PrimaryEntity.FormattedValues[fields[i]].ToString();
                                    }
                                    else if (PrimaryEntity[fields[i]].GetType() == typeof(EntityReference))
                                    {
                                        values[i] = ((EntityReference)PrimaryEntity[fields[i]]).Name;
                                    }
                                    else
                                    {
                                        values[i] = PrimaryEntity[fields[i]].ToString();
                                    }
                                }
                                else
                                {
                                    values[i] = "";
                                }
                            }
                            if (Logging)
                            {
                                Log("Executing Mail Merge", LogFilePath);
                            }
                            doc.MailMerge.Execute(fields, values);
                            MemoryStream UpdateDoc = new MemoryStream();
                            if (Logging)
                            {
                                Log("Saving Document", LogFilePath);
                            }
                            switch (saveAs.ToLower())
                            {
                            case "bmp":
                                doc.Save(UpdateDoc, SaveFormat.Bmp);
                                break;

                            case "doc":
                                doc.Save(UpdateDoc, SaveFormat.Doc);
                                break;

                            case "html":
                                doc.Save(UpdateDoc, SaveFormat.Html);
                                break;

                            case "jpeg":
                                doc.Save(UpdateDoc, SaveFormat.Jpeg);
                                break;

                            case "pdf":
                                doc.Save(UpdateDoc, SaveFormat.Pdf);
                                break;

                            case "png":
                                doc.Save(UpdateDoc, SaveFormat.Png);
                                break;

                            case "rtf":
                                doc.Save(UpdateDoc, SaveFormat.Rtf);
                                break;

                            case "text":
                            case "txt":
                                doc.Save(UpdateDoc, SaveFormat.Text);
                                break;

                            default:
                                doc.Save(UpdateDoc, SaveFormat.Docx);
                                break;
                            }
                            byte[] byteData = UpdateDoc.ToArray();
                            // Encode the data using base64.
                            string encodedData = System.Convert.ToBase64String(byteData);

                            if (Logging)
                            {
                                Log("Creating Attachment", LogFilePath);
                            }
                            Entity NewNote = new Entity("annotation");
                            // Im going to add Note to entity
                            if (savePrimary)
                            {
                                NewNote.Attributes.Add("objectid", new EntityReference(PrimaryEntityName, PrimaryEntityId));
                            }
                            NewNote.Attributes.Add("subject", FileName != "" ? FileName : "Aspose .NET AutoMerge Created Document." + saveAs);

                            // Set EncodedData to Document Body
                            NewNote.Attributes.Add("documentbody", encodedData);

                            // Set the type of attachment
                            NewNote.Attributes.Add("mimetype", @"application/vnd.openxmlformats-officedocument.wordprocessingml.document");
                            NewNote.Attributes.Add("notetext", "Document Created using template");

                            // Set the File Name
                            NewNote.Attributes.Add("filename", FileName != "" ? FileName : "Aspose .NET AutoMerge Created Document." + saveAs);
                            Guid NewNoteId = service.Create(NewNote);
                            OutputAttachmentId.Set(executionContext, new EntityReference("annotation", NewNoteId));
                            if (Logging)
                            {
                                Log("Successfull", LogFilePath);
                            }
                        }
                    }
                }

                if (Logging)
                {
                    Log("Workflow Executed Successfully", LogFilePath);
                }
            }
            catch (Exception ex)
            {
                Log(ex.Message, LogFilePath);
                if (ex.InnerException != null)
                {
                    Log(ex.InnerException.Message, LogFilePath);
                }
            }
        }
Example #16
0
        private void SaveAs_Click(object sender, EventArgs e)
        {
            SaveAs newForm = new SaveAs("test.txt", OutFindInf.Text);

            newForm.Show();
        }
Example #17
0
 private void sparaBildToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SaveAs.ShowDialog();
 }
Example #18
0
                public static void Show(Type WindowType,
                                        PortScanMode PortScanMode = PortScanMode.Normal)
                {
                    try
                    {
                        switch (WindowType)
                        {
                            case Type.About:
                                if (aboutForm == null || aboutPanel == null | aboutPanel.VisibleState==DockState.Unknown)
                                {
                                    aboutForm = new About(aboutPanel);
                                    aboutPanel = aboutForm;
                                    aboutForm.Show(frmMain.Default.pnlDock);
                                }
                                else
                                {
                                    aboutPanel.Focus();
                                    aboutPanel.Show();
                                    aboutPanel.BringToFront();
                                    aboutForm.Focus();
                                }
                                
                                break;
                            case Type.ADImport:
                                adimportForm = new ADImport(adimportPanel);
                                adimportPanel = adimportForm;
                                adimportPanel.Show(frmMain.Default.pnlDock);
                                break;
                            case Type.Options:
                                optionsForm = new frmOptions(optionsPanel);
                                optionsForm.Show(frmMain.Default.pnlDock);
                                break;
                            case Type.SaveAs:
                                saveasForm = new SaveAs(saveasPanel);
                                saveasPanel = saveasForm;
                                saveasForm.Show(frmMain.Default.pnlDock);
                                break;
                            case Type.SSHTransfer:
                                sshtransferForm = new SSHTransfer(sshtransferPanel);
                                sshtransferPanel = sshtransferForm;
                                sshtransferForm.Show(frmMain.Default.pnlDock);
                                break;
                            case Type.Update:
                                if (updateForm == null || updatePanel == null || updatePanel.VisibleState == DockState.Unknown)
                                {
                                    updateForm = new UI.Window.Update(updatePanel);
                                    updatePanel = updateForm;
                                    updateForm.Show(frmMain.Default.pnlDock);
                                }
                                else
                                {
                                    updatePanel.Focus();
                                    updatePanel.Show();
                                    updatePanel.BringToFront();
                                    updateForm.Focus();
                                }
                                break;
                            case Type.Help:
                                helpForm = new Help(helpPanel);
                                helpPanel = helpForm;
                                helpForm.Show(frmMain.Default.pnlDock);
                                break;
                            case Type.ExternalApps:
                                if (externalappsForm == null || externalappsPanel == null || externalappsPanel.VisibleState == DockState.Unknown)
                                {
                                    externalappsForm = new ExternalApps(externalappsPanel);
                                    externalappsPanel = externalappsForm;
                                    externalappsForm.Show(frmMain.Default.pnlDock);
                                }
                                else
                                {
                                    externalappsPanel.Focus();
                                    externalappsPanel.Show();
                                    externalappsPanel.BringToFront();
                                    externalappsForm.Focus();
                                }
                                break;
                            case Type.PortScan:
                                portscanForm = new PortScan(portscanPanel, PortScanMode);
                                portscanPanel = portscanForm;
                                portscanForm.Show(frmMain.Default.pnlDock);
                                break;
                            case Type.UltraVNCSC:
                                ultravncscForm = new UltraVNCSC(ultravncscPanel);
                                ultravncscPanel = ultravncscForm;
                                ultravncscForm.Show(frmMain.Default.pnlDock);
                                break;
                            case Type.ComponentsCheck:
                                if (componentscheckForm == null || componentscheckPanel == null || componentscheckPanel.VisibleState == DockState.Unknown)
                                {
                                    componentscheckForm = new ComponentsCheck(componentscheckPanel);
                                    componentscheckPanel = componentscheckForm;
                                    componentscheckForm.Show(frmMain.Default.pnlDock);
                                }
                                else
                                {
                                    componentscheckPanel.Focus();
                                    componentscheckPanel.Show();
                                    componentscheckPanel.BringToFront();
                                    componentscheckForm.Focus();
                                }

                                break;
                            case Type.Announcement:
                                AnnouncementForm = new UI.Window.Announcement(AnnouncementPanel);
                                AnnouncementPanel = AnnouncementForm;
                                AnnouncementForm.Show(frmMain.Default.pnlDock);
                                break;
                            case Type.ConnectionStatus:
                                connectionStatusForm = new ConnectionStatusForm();
                                componentscheckPanel = connectionStatusForm;
                                connectionStatusForm.Show(frmMain.Default.pnlDock);
                                break;
                            case Type.QuickText:

                                if (quicktextPanel != null && (quicktextForm == null || quicktextPanel == null | quicktextPanel.VisibleState == DockState.Unknown))
                                {
                                    quicktextForm = new QuickTextEdit(quicktextPanel);
                                    quicktextPanel = quicktextForm;
                                    quicktextForm.Show(frmMain.Default.pnlDock);
                                }
                                else
                                {
                                    quicktextPanel.Focus();
                                    quicktextPanel.Show();
                                    quicktextPanel.BringToFront();
                                    quicktextForm.Focus();
                                }
                                
                                break;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageCollector.AddMessage(MessageClass.ErrorMsg,
                                                    (string)
                                                    ("Show (Runtime.Windows) failed" +
                                                     Constants.vbNewLine + ex.Message), true);
                    }
                }
Example #19
0
        private void SaveAs()
        {
            if (!this.Text.EndsWith("*"))
            {
                if (!CurrentSaving)
                {
                    RemoteSource MemberInfo = this.Tag as RemoteSource;
                    if (MemberInfo != null)
                    {
                        SaveAs SaveAsWindow = new SaveAs(MemberInfo);
                        SaveAsWindow.ShowDialog();
                        if (SaveAsWindow.Success)
                        {
                            Thread gothread = null;
                            CurrentSaving = true;
                            Editor.TheEditor.SetStatus("Saving " + MemberInfo.GetName() + "..");
                            switch (SaveAsWindow.SourceInfo().GetFS())
                            {
                            case FileSystem.QSYS:
                                gothread = new Thread((ThreadStart) delegate
                                {
                                    bool UploadResult = IBMiUtils.UploadMember(MemberInfo.GetLocalFile(), SaveAsWindow.SourceInfo().GetLibrary(), SaveAsWindow.SourceInfo().GetSPF(), SaveAsWindow.SourceInfo().GetMember());
                                    if (UploadResult == false)
                                    {
                                        MessageBox.Show("Failed to upload to " + MemberInfo.GetName() + ".");
                                    }

                                    this.Invoke((MethodInvoker) delegate
                                    {
                                        Editor.TheEditor.SetStatus(MemberInfo.GetName() + " " + (UploadResult ? "" : "not ") + "saved.");
                                    });

                                    CurrentSaving = false;
                                });
                                break;

                            case FileSystem.IFS:
                                gothread = new Thread((ThreadStart) delegate
                                {
                                    bool UploadResult = IBMiUtils.UploadFile(MemberInfo.GetLocalFile(), SaveAsWindow.SourceInfo().GetIFSPath());
                                    if (UploadResult == false)
                                    {
                                        MessageBox.Show("Failed to upload to " + MemberInfo.GetName() + "." + MemberInfo.GetExtension() + ".");
                                    }

                                    this.Invoke((MethodInvoker) delegate
                                    {
                                        Editor.TheEditor.SetStatus(MemberInfo.GetName() + "." + MemberInfo.GetExtension() + " " + (UploadResult ? "" : "not ") + "saved.");
                                    });

                                    CurrentSaving = false;
                                });
                                break;
                            }

                            if (gothread != null)
                            {
                                gothread.Start();
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("You must save the source before you can Save-As.");
                }
            }
        }
Example #20
0
        // этот метод парсит обхявление
        public async void ParseArticles(Request[] refs)
        {
            foreach (var item in refs)
            {
                int time1 = x.Next(2000, 6000);
                Thread.Sleep(time1);

                try
                {
                    //NetworkCredential credentials = new NetworkCredential();
                    Task <HtmlAgilityPack.HtmlDocument> _task = new Task <HtmlAgilityPack.HtmlDocument>(() => { return(new HtmlWeb().Load(item.Url, "GET")); }); _task.Start();
                    HtmlAgilityPack.HtmlDocument        doc   = await _task.ConfigureAwait(false);

                    // 3 это формирует запрос, который уходит на сервер и обрабатывается там и выдает ответ.
                    //HttpWebRequest request = WebRequest.Create(item.Url) as HttpWebRequest;



                    ////// Obtain the 'Proxy' of the  Default browser.
                    ////IWebProxy proxy = request.Proxy;

                    ////WebProxy myProxy = new WebProxy();
                    ////string proxyAddress;

                    ////try
                    ////{
                    ////    proxyAddress = "http://201.55.46.6:80";

                    ////    if (proxyAddress.Length > 0)
                    ////    {
                    ////        Uri newUri = new Uri(proxyAddress);
                    ////        // Associate the newUri object to 'myProxy' object so that new myProxy settings can be set.
                    ////        myProxy.Address = newUri;
                    ////        // Create a NetworkCredential object and associate it with the
                    ////        // Proxy property of request object.
                    ////        request.Proxy = myProxy;
                    ////    }
                    ////}
                    ////catch (Exception ex)
                    ////{
                    ////    ex.ToString();
                    ////}


                    ////request.Proxy = new WebProxy("87.98.147.195", 3128);


                    //request.UserAgent = item.UserAgent;
                    //request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*;q=0.8";
                    //request.KeepAlive = true;
                    //request.AllowAutoRedirect = true;
                    //request.Timeout = 60000;
                    //request.Method = "POST";
                    //request.Referer = item.UrlReferer;
                    //request.Headers["Accept-Language"] = "ru-RU";

                    //// 4 получаем ответ
                    //HttpWebResponse response = request.GetResponse() as HttpWebResponse;

                    //// 5 поток данных получаемых с сервера
                    //StreamReader sr = new StreamReader(response.GetResponseStream());
                    //sr.ReadLine();
                    //string html = sr.ReadToEnd();

                    //HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                    //doc.LoadHtml(html);

                    int time2 = x.Next(2000, 6000);
                    Thread.Sleep(time2);

                    //парсим номер телефона
                    var _phone = await _parsePhone(AvitoUrl + doc.DocumentNode.SelectSingleNode("//a[@title='Телефон продавца']").Attributes["href"].Value + "?async", item.Url, item.UserAgent);


                    //Articles _article = new Articles();
                    //_article.Url = item.Url;
                    //_article.Phone = _phone;
                    //Console.WriteLine(_article.Url + " " + _article.Phone);

                    int time3 = time1 + time2;
                    stringBuilder.Append(item.Url + "; " + _phone + "; " + time3).AppendLine();
                    counter++;

                    SaveAs saveAs = new SaveAs();
                    saveAs.SaveAsCSV(stringBuilder, counter.ToString());
                    stringBuilder.Clear();

                    //if (counter > 100)
                    //{
                    if (counter % 10 == 0)
                    {
                        Thread.Sleep(x.Next(counter / 2, counter));

                        //SaveAs saveAs = new SaveAs();
                        //saveAs.SaveAsCSV(stringBuilder, counter);
                        //MessageBox.Show(stringBuilder.ToString());
                    }
                    //}
                }
                catch (Exception ex)
                {
                    counter++;
                    StringBuilder sb = new StringBuilder();
                    sb.Append(item.Url + "/r/n" + ex.ToString());
                    SaveAs saveAs = new SaveAs();
                    saveAs.SaveAsCSV(sb, counter.ToString() + " error");
                    sb.Clear();
                    Thread.Sleep(x.Next(counter * 5, counter * 20));

                    error.Add(true);
                    if (error.Count > 2)
                    {
                        Thread.Sleep(x.Next(counter * 10, counter * 20));
                        //error.Clear();
                    }
                }
            }
        }
Example #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XLSToCSVConverter"/> class.
 /// </summary>
 /// <param name="sourceFile">
 /// The path to the xls(b/x) being converted
 /// </param>
 /// <param name="importheader">
 /// Option to import the header row or not.
 /// </param>
 /// <param name="saveAs">
 /// The option to save the xls(x/b) as one csv file or a csv file per worksheet.
 /// </param>
 /// <param name="aceVersion">
 /// The ACE DB Override version. (Default 12.0).
 /// </param>
 /// <param name="excelVersion">
 /// The Excel Override version. (Default 12.0).
 /// </param>
 /// /// <param name="delimeter">
 /// The CSV file delimeter requried.
 /// </param>
 /// <param name="qualifier">
 /// The CSV file qualifier required.
 /// </param>
 public ExcelData(string sourceFile, ImportHeader importheader, SaveAs saveAs, string aceVersion, string excelVersion, char delimeter, char qualifier)
     : this(sourceFile, importheader, saveAs, delimeter, qualifier)
 {
     this.ACEDbVersionOverride = aceVersion;
     this.ExcelVersionOverride = excelVersion;
 }
Example #22
0
        /***************************************************/

        public bool RunCommand(SaveAs command)
        {
            return(m_model.File.Save(command.FileName) == 0);
        }
Example #23
0
        private void SaveAs_Click(object sender, EventArgs e)
        {
            SaveAs newForm = new SaveAs();

            newForm.Show();
        }
Example #24
0
 private void Execute(KeyRoutedEventArgs e)
 {
     if (KeyModifiers == (VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift) && CurrentKey == VirtualKey.N && KeyState == CoreVirtualKeyStates.Down)
     {
         ClonePage.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.N && KeyState == CoreVirtualKeyStates.Down)
     {
         NewPage.Execute(null);
     }
     else if (KeyModifiers == (VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift) && CurrentKey == VirtualKey.S && KeyState == CoreVirtualKeyStates.Down)
     {
         SaveAs.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.S && KeyState == CoreVirtualKeyStates.Down)
     {
         Save.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.O && KeyState == CoreVirtualKeyStates.Down)
     {
         Open.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.L && KeyState == CoreVirtualKeyStates.Down)
     {
         Library.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == (VirtualKey)186 && KeyState == CoreVirtualKeyStates.Down)
     {
         GridLines.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.U && KeyState == CoreVirtualKeyStates.Down)
     {
         SmartGuide.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.R && KeyState == CoreVirtualKeyStates.Down)
     {
         RulerVisibility.Execute(null);
     }
     else if (KeyModifiers == (VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift) && CurrentKey == VirtualKey.A && KeyState == CoreVirtualKeyStates.Down)
     {
         UnSelect.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.Number2 && KeyState == CoreVirtualKeyStates.Down)
     {
         Lock.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.Number3 && KeyState == CoreVirtualKeyStates.Down)
     {
         UnLock.Execute(null);
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.C && KeyState == CoreVirtualKeyStates.Down)
     {
         Copy.Execute(null);
         e.Handled = true;
     }
     else if (KeyModifiers == VirtualKeyModifiers.Control && CurrentKey == VirtualKey.V && KeyState == CoreVirtualKeyStates.Down)
     {
         Paste.Execute(null);
         e.Handled = true;
     }
 }
Example #25
0
 public IconKind(int size, byte bitsPerPixel, SaveAs saveAs)
 {
     Size         = (short)size;
     BitsPerPixel = bitsPerPixel;
     SaveAs       = saveAs;
 } // constructor