Beispiel #1
0
        public void Navigate(String title, Uri uri)
        {
            // Add navigation handler here
            String url = uri.ToString();

            if (!Views.ContainsKey(url))
            {
                if (url.StartsWith("http://") || url.StartsWith("mako://"))
                {
                    ShowControl(new SPWebBrowser(url), "Browser", uri);
                }
                if (url.StartsWith("spotdev:start"))
                {
                    ShowControl(new SPWebBrowser(), "Browser", uri);
                }
                if (url.Split(':')[1] == "project")
                {
                    // Create a new window based on query
                    String        app    = url.Split(':')[2];
                    String[]      tokens = url.Split(':');
                    StringBuilder path   = new StringBuilder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Spotify");
                    for (int i = 2; i < tokens.Length - 1; i++)
                    {
                        path.Append("\\" + tokens[i]);
                    }
                    FileInfo file = new FileInfo(path.ToString());

                    if (file.Name == "manifest.json")
                    {
#if (manifest)
                        SPManifestEditor manifestEditor = new SPManifestEditor();
                        manifestEditor.LoadFile(file.FullName);
                        ShowControl(manifestEditor, file.Name, uri);
                        if (this.TabChanged != null)
                        {
                            this.TabChanged(this, new EventArgs());
                        }
#else
                        SPTextEditor textEditor = new SPTextEditor();
                        textEditor.LoadFile(file.FullName);
                        ShowControl(textEditor, file.Name, uri);
                        if (this.TabChanged != null)
                        {
                            this.TabChanged(this, new EventArgs());
                        }
#endif
                    }
                    else
                    {
                        switch (file.Extension)
                        {
                        case ".txt":
                        case ".css":
                        case ".js":
                        case ".json":
                        {
                            SPTextEditor textEditor = new SPTextEditor();
                            textEditor.LoadFile(file.FullName);
                            ShowControl(textEditor, file.Name, uri);
                            if (this.TabChanged != null)
                            {
                                this.TabChanged(this, new EventArgs());
                            }
                        }
                        break;

                        case ".html":
                        case ".xhtml":

                        {
                            SPHTMLEditor textEditor = new SPHTMLEditor();
                            textEditor.LoadFile(file.FullName);
                            ShowControl(textEditor, file.Name, uri);
                            if (this.TabChanged != null)
                            {
                                this.TabChanged(this, new EventArgs());
                            }
                        }
                        break;
                        }
                    }
                }
            }
            else
            {
                SPTab c = Views[url];
                this.activeTab = c;
                c.Control.BringToFront();
            }
            this.Draw(this.CreateGraphics());
        }
Beispiel #2
0
        public void Navigate(String title, Uri uri)
        {
            // Add navigation handler here
            String url = uri.ToString();

            if (!Views.ContainsKey(url))
            {
                if (url.StartsWith("http://") || url.StartsWith("mako://"))
                {
                    ShowControl(new SPWebBrowser(url), "Browser", uri);
                }
                if (url.StartsWith("spotdev:start"))
                {
                    ShowControl(new SPWebBrowser(), "Browser", uri);
                }
                if (url.Split(':')[1] == "project")
                {
                    // Create a new window based on query
                    String app = url.Split(':')[2];
                    String[] tokens = url.Split(':');
                    StringBuilder path = new StringBuilder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)+"\\Spotify");
                    for (int i = 2; i <tokens.Length-1 ; i++)
                    {
                        path.Append("\\" + tokens[i] );
                    }
                    FileInfo file = new FileInfo(path.ToString());

                    if (file.Name == "manifest.json")
                    {
            #if(manifest)

                        SPManifestEditor manifestEditor = new SPManifestEditor();
                        manifestEditor.LoadFile(file.FullName);
                        ShowControl(manifestEditor, file.Name, uri);
                        if (this.TabChanged != null)
                            this.TabChanged(this, new EventArgs());
            #else
                        SPTextEditor textEditor = new SPTextEditor();
                        textEditor.LoadFile(file.FullName);
                        ShowControl(textEditor, file.Name, uri);
                        if (this.TabChanged != null)
                            this.TabChanged(this, new EventArgs());
            #endif
                    }
                    else
                    {
                        switch (file.Extension)
                        {

                            case ".txt":
                            case ".css":
                            case ".js":
                            case ".json":
                                {
                                    SPTextEditor textEditor = new SPTextEditor();
                                    textEditor.LoadFile(file.FullName);
                                    ShowControl(textEditor, file.Name, uri);
                                    if (this.TabChanged != null)
                                        this.TabChanged(this, new EventArgs());

                                }
                                break;
                            case ".html":
                            case ".xhtml":

                                {
                                    SPHTMLEditor textEditor = new SPHTMLEditor();
                                    textEditor.LoadFile(file.FullName);
                                    ShowControl(textEditor, file.Name, uri);
                                    if (this.TabChanged != null)
                                        this.TabChanged(this, new EventArgs());

                                }
                                break;
                        }
                    }

                }
            }
            else
            {
                SPTab c = Views[url];
                this.activeTab = c;
                c.Control.BringToFront();
            }
            this.Draw(this.CreateGraphics());
        }