Beispiel #1
0
        public void CodeToDesign()
        {
            if (idoc2 != null && idoc2.body != null)
            {
                //相对路径转绝对路径
                string htmlCode = codeTextEditorControl.Text;
                string ostr     = "${srs_";
                while (htmlCode.IndexOf(ostr) > 0)
                {
                    string mediaId = htmlCode.Substring(htmlCode.IndexOf(ostr) + 6, 32);

                    SimpleExIndexXmlElement ele = Service.Sdsite.CurrentDocument.GetElementById(mediaId) as SimpleExIndexXmlElement;
                    if (ele != null)
                    {
                        if (!ResourcesIdPaths.ContainsKey(ele.Id))
                        {
                            ResourcesIdPaths.Add(ele.Id, ele.AbsoluteFilePath);
                        }

                        string PATH = SiteResourceService.ParseFormatId(ele.Id, true);
                        htmlCode = htmlCode.Replace(htmlCode.Substring(htmlCode.IndexOf(ostr), 39), "file:///" + ele.AbsoluteFilePath.Replace("\\", "/"));
                    }
                    else
                    {
                        break;
                    }
                }

                idoc2.body.innerHTML = htmlCode;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 启动预览
        /// </summary>
        public void Run()
        {
            TcpListener listener = ClientService.CreatTcpListener();

            Port = ClientService.Port;
            Jeelu.SimplusD.PathService.Initialize(Application.StartupPath);
            while (true)
            {
                TcpClient     client   = listener.AcceptTcpClient();
                NetworkStream ns       = client.GetStream();
                StreamReader  srs      = new StreamReader(ns);
                string        received = "";                                    //接收的GET请求
                received  += srs.ReadLine();                                    //获得GET请求
                this.Index = StringService.GetRequest(received);                //获取请求字符川
                string resquestType = StringService.GetRequestType(this.Index); //获取请求类型
                //如果发送php和shtml请求,说明sdsite被改编重新打开sdsite实例,则重新打开sdsite
                if (resquestType == "php" || resquestType == "shtml" || string.IsNullOrEmpty(resquestType))
                {
                    ///SdsiteService.OpenSdsite(PathService.AbsolutePath);
                    SiteResourceService.Initialize
                        (null,
                        GetResourceAbsolutePath.GetResourceAbsPath,
                        GetResourceAbsolutePath.GetResourcePath,
                        GetResourceAbsolutePath.GetResourceUrl,
                        null);
                }
                //处理除不同类型请求
                HttpType(this.Index, resquestType, ns);
            }
        }
Beispiel #3
0
 private void btnAddImage_Click(object sender, EventArgs e)
 {
     ImageId = SiteResourceService.SelectResource(MediaFileType.Pic, Service.Workbench.MainForm);
     if (!string.IsNullOrEmpty(ImageId))
     {
         this.conPicShow.Image = System.Drawing.Image.FromFile(AddImageToControl(ImageId));
     }
 }
Beispiel #4
0
        private string AddImageToControl(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(string.Empty);
            }
            string picPath = SiteResourceService.ParseFormatId("${srs_" + id + "}", true);

            return(picPath);
        }
Beispiel #5
0
        private void openDocumentBtn_Click(object sender, EventArgs e)
        {
            string resourceId = SiteResourceService.SelectResource(MediaFileType.Pic, this);

            if (!string.IsNullOrEmpty(resourceId))
            {
                SdsiteXmlDocument      doc     = Service.Sdsite.CurrentDocument;
                FileSimpleExXmlElement fileEle = doc.GetElementById(resourceId) as FileSimpleExXmlElement;
                picLinkPathTextBox.Text = fileEle.RelativeFilePath;
            }
        }
Beispiel #6
0
        public void SetFormedioPathChange(MediaFileType mediaType)
        {
            string resourceId = SiteResourceService.SelectResource(mediaType, this);

            if (resourceId != null)
            {
                SdsiteXmlDocument      doc     = Service.Sdsite.CurrentDocument;
                FileSimpleExXmlElement fileEle = doc.GetElementById(resourceId) as FileSimpleExXmlElement;
                pathTextBox.Text = fileEle.AbsoluteFilePath;
                try
                {
                    flashInfo = new FlashInfo(fileEle.AbsoluteFilePath);
                }
                catch
                { }
                if (flashInfo != null)
                {
                    widthNumUpDown.Value  = flashInfo.Width;
                    heightNumUpDown.Value = flashInfo.Height;
                    ratio = widthNumUpDown.Value / heightNumUpDown.Value;
                    limitScaleCheckBox.Visible = true;
                    limitScaleCheckBox.Enabled = true;
                }
                else
                {
                    widthNumUpDown.Value       = 100;
                    heightNumUpDown.Value      = 100;
                    limitScaleCheckBox.Visible = false;
                }
                widthUintComboBox.SelectedIndex = heightUintComboBox.SelectedIndex = 0;

                //设置窗体的一些默认值
                this.widthCheckBox.Checked    = true;
                this.heightCheckBox.Checked   = true;
                this.loopCheckBox.Checked     = true;
                this.autoPlayCheckBox.Checked = true;

                this.MediaID = resourceId;
            }
        }
Beispiel #7
0
        private void picPathBtn_Click(object sender, EventArgs e)
        {
            string resourceId = SiteResourceService.SelectResource(MediaFileType.Pic, this);

            if (!string.IsNullOrEmpty(resourceId))
            {
                SdsiteXmlDocument      doc     = Service.Sdsite.CurrentDocument;
                FileSimpleExXmlElement fileEle = doc.GetElementById(resourceId) as FileSimpleExXmlElement;
                picPathTextBox.Text = fileEle.AbsoluteFilePath;
                Size sizeofpic = GetSizeOfPic(picPathTextBox.Text.Trim());
                PicWidthNumericUpDown.Value  = sizeofpic.Width;
                PicHeightNumericUpDown.Value = sizeofpic.Height;
                ratio = Convert.ToDecimal(sizeofpic.Width) / Convert.ToDecimal(sizeofpic.Height);
                widthUnitComBox.SelectedIndex = heightUnitComboBox.SelectedIndex = 0;

                this.widthCheckBox.Checked  = true;
                this.heightCheckBox.Checked = true;
                this.limitCheckBox.Enabled  = true;
                this.limitCheckBox.Checked  = true;

                this.MediaID = resourceId;
            }
        }
Beispiel #8
0
        /// <summary>
        /// 元素绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void designWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            IHTMLDocument3 pBody = ((IWebBrowser2)designWebBrowser.ActiveXInstance).Document as IHTMLDocument3;

            m_elemEvents.ConnectToHtmlEvents(pBody.documentElement);

            if (idoc2.body != null)
            {
                idoc2.body.innerHTML       = _articleText;
                codeTextEditorControl.Text = GeneralMethods.tidy(idoc2.body.innerHTML);

                string htmlCode = codeTextEditorControl.Text;
                string ostr     = "${srs_";
                while (htmlCode.IndexOf(ostr) > 0)
                {
                    string mediaId = htmlCode.Substring(htmlCode.IndexOf(ostr) + 6, 32);

                    SimpleExIndexXmlElement ele = Service.Sdsite.CurrentDocument.GetElementById(mediaId) as SimpleExIndexXmlElement;
                    if (ele != null)
                    {
                        if (!ResourcesIdPaths.ContainsKey(ele.Id))
                        {
                            ResourcesIdPaths.Add(ele.Id, ele.AbsoluteFilePath);
                        }

                        string PATH = SiteResourceService.ParseFormatId(ele.Id, true);
                        htmlCode = htmlCode.Replace(htmlCode.Substring(htmlCode.IndexOf(ostr), 39), "file:///" + ele.AbsoluteFilePath.Replace("\\", "/"));
                    }
                    else
                    {
                        break;
                    }
                }
            }
            DesignToCode();
            CodeToDesign();
        }
Beispiel #9
0
 /// <summary>
 /// 浏览背景图片响应Css变化
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void btnBrowsePic_Click(object sender, EventArgs e)
 {
     cssSection.Properties["background-image"] = @"url(" + SiteResourceService.SelectResourceFormat(MediaFileType.Pic, Service.Workbench.MainForm) + ")";
     GetBackgroudLayout();
     textBoxCSSText.Text = cssSection.ToString() + myBoxModelPanel.ToString();;
 }
Beispiel #10
0
        /// <summary>
        /// 初始化
        /// </summary>
        public static void Initialize(string sdsite)
        {
            System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException       += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            _willOpenFile = sdsite;

            CssResources.Initialize();

            //初始化的顺序是有一定规则的
            Service.Util.Initialize();
            Service.Property.Initialize();
            PathService.Initialize(Application.StartupPath);
            Utility.Pinyin.Initialize(Path.Combine(PathService.SoftwarePath, "pinyin.mb"));
            ResourceService.Initialize();
            StringParserService.Initialize(ResourceService.GetResourceText);
            SoftwareOption.Load();
            ResourcesReader.InitializeResources("Configuration", SoftwareOption.General.ApplicationLanguage, null);
            Service.FileBinding.Initialize();
            Service.DesignData.Load(PathService.Config_PadLayout);
            Service.RecentFiles.Initialize();
            Service.SiteDataManager.Initialize();
            Service.ListView.InitColumn();
            SiteResourceService.Initialize(SelectResource, GetResourcePath, GetResourceAbsPath, GetResourceUrl, ImportResourceFile);
            AutoLayoutPanel.Initialize(PathService.CL_DataSources_Folder);

            LayoutConfiguration.LoadLayoutConfiguration();
            _mainForm = new WorkbenchForm();

            CssUtility.Initialize(_mainForm.SelectImageResource);
            ////初始化的顺序是有一定规则的
            Service.User.Initialize(_mainForm.ShowLoginForm);
            Service.WebView.Initialize(_mainForm.SinglePagePublish);
            MessageService.Initialize(_mainForm);
            ToolbarManager.Initialize(_mainForm);
            MenuStripManager.Initialize(_mainForm);
            StatusBarManager.Initialize(_mainForm);
            FindAndReplaceForm.Initialize(_mainForm);
            //ResultsPad.Initialize(_mainForm);
            MenuStateManager.Initialize();

            Service.StatusBar.Initialize(StatusBarManager.CurrentStatusStrip);
            Service.Workbench.Initialize(
                _mainForm,
                _mainForm.OpenWorkDocument,
                _mainForm.NavigationUrl,
                _mainForm.MainTreePad.TreeViewExPad.RefreshSiteTreeData,
                ShowDialogForCreateProject,
                ShowDialogForOpenProject,
                _mainForm.GotoTree,
                _mainForm.ActivateForm);

            ///监听项目的打开事件
            Service.Project.ProjectOpened  += new EventHandler(ProjectService_ProjectOpened);
            Service.Project.ProjectClosing += new EventHandler(ProjectService_ProjectClosing);
            Service.Project.ProjectClosed  += new EventHandler(ProjectService_ProjectClosed);

            OnWorkbenchCreated();

            _mainForm.OnActiveWorkspaceTypeChanged(new WorkspaceTypeEventArgs(WorkspaceType.Default));
            _mainForm.MainDockPanel.ActiveDocumentChanged += new EventHandler(_mainForm.MainDockPanel_ActiveDocumentChanged);

            if (Initialized != null)
            {
                Initialized(null, EventArgs.Empty);
            }
        }