Beispiel #1
0
        private void memberToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RemoteSource member;
            NewMember    newMemberForm = new NewMember();

            newMemberForm.ShowDialog();
            if (newMemberForm.created)
            {
                new Thread((ThreadStart) delegate {
                    string resultFile = IBMiUtils.DownloadMember(newMemberForm._lib, newMemberForm._spf, newMemberForm._mbr, (newMemberForm._type == "*NONE" ? "" : newMemberForm._type));

                    if (resultFile != "")
                    {
                        member = new RemoteSource(resultFile, newMemberForm._lib, newMemberForm._spf, newMemberForm._mbr, newMemberForm._type, true);
                        //LOCK HERE
                        member.Lock();
                        this.Invoke((MethodInvoker) delegate
                        {
                            Editor.TheEditor.AddSourceEditor(member, GetBoundLangType(newMemberForm._type));
                        });
                    }
                }).Start();
            }
            newMemberForm.Dispose();
        }
Beispiel #2
0
        public static void OpenSource(RemoteSource Source)
        {
            SourceEditor sourcePanel;
            string       resultFile = "";
            string       text       = Source.GetName() + (Source.GetExtension() != "" ? '.' + Source.GetExtension().ToLower() : "");

            Editor.TheEditor.SetStatus("Fetching file " + text + "...");

            new Thread((ThreadStart) delegate
            {
                switch (Source.GetFS())
                {
                case FileSystem.QSYS:
                    resultFile = IBMiUtils.DownloadSourceMember(Source.GetLibrary(), Source.GetObject(), Source.GetName(), Source.GetExtension());
                    break;

                case FileSystem.IFS:
                    resultFile = IBMiUtils.DownloadFile(Source.GetRemoteFile());
                    break;
                }

                if (resultFile != "")
                {
                    TheEditor.SetStatus("Opening file " + text + "...");

                    Source._Local = resultFile;
                    Source.Lock();

                    sourcePanel = new SourceEditor(Source.GetLocalFile(), GetBoundLangType(Source.GetExtension()), Source.GetRecordLength(), !Source.IsEditable());

                    sourcePanel.Tag  = Source;
                    sourcePanel.Text = text;

                    switch (Source.GetFS())
                    {
                    case FileSystem.QSYS:
                        sourcePanel.ToolTipText = Source.GetLibrary() + "/" + Source.GetObject() + ":" + Source.GetName() + "." + Source.GetExtension().ToLower();
                        break;

                    case FileSystem.IFS:
                        sourcePanel.ToolTipText = Source.GetRemoteFile();
                        break;
                    }

                    TheEditor.Invoke((MethodInvoker) delegate
                    {
                        TheEditor.AddTool(sourcePanel, DockState.Document, false);
                    });
                }
                else
                {
                    switch (Source.GetFS())
                    {
                    case FileSystem.QSYS:
                        MessageBox.Show("Unable to download member " + Source.GetLibrary() + "/" + Source.GetObject() + "." + Source.GetName() + ". Please check it exists and that you have access to the remote system.");
                        break;
                    }
                }
            }).Start();
        }
Beispiel #3
0
        public static void OpenExistingSource(RemoteSource Source)
        {
            string text = Path.GetFileName(Source.GetName() + "." + Source.GetExtension().ToLower());

            if (File.Exists(Source.GetLocalFile()))
            {
                SourceEditor sourcePanel = new SourceEditor(Source.GetLocalFile(), GetBoundLangType(Source.GetExtension()), Source.GetRecordLength(), !Source.IsEditable());

                sourcePanel.Tag  = Source;
                sourcePanel.Text = text;

                Source.Lock();
                TheEditor.AddTool(sourcePanel, DockState.Document);
            }
            else
            {
                MessageBox.Show("There was an error opening the local file. '" + Source.GetLocalFile() + "' does not exist");
            }
        }
Beispiel #4
0
        public static void OpenSource(RemoteSource source)
        {
            string resultFile = "";
            Thread gothread   = new Thread((ThreadStart) delegate {
                switch (source.GetFS())
                {
                case FileSystem.QSYS:
                    resultFile = IBMiUtils.DownloadMember(source.GetLibrary(), source.GetObject(), source.GetName(), source.GetExtension());
                    break;

                case FileSystem.IFS:
                    resultFile = IBMiUtils.DownloadFile(source.GetRemoteFile());
                    break;
                }

                if (resultFile != "")
                {
                    source._Local = resultFile;
                    //LOCK HERE
                    source.Lock();
                    TheEditor.Invoke((MethodInvoker) delegate
                    {
                        TheEditor.AddSourceEditor(source, GetBoundLangType(source.GetExtension()));
                    });
                }
                else
                {
                    switch (source.GetFS())
                    {
                    case FileSystem.QSYS:
                        MessageBox.Show("Unable to download member " + source.GetLibrary() + "/" + source.GetObject() + "." + source.GetName() + ". Please check it exists and that you have access to the remote system.");
                        break;
                    }
                }
            });

            gothread.Start();
        }