当前位置: 首页>>代码示例>>C#>>正文


C# Page.MapPath方法代码示例

本文整理汇总了C#中System.Web.UI.Page.MapPath方法的典型用法代码示例。如果您正苦于以下问题:C# Page.MapPath方法的具体用法?C# Page.MapPath怎么用?C# Page.MapPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.Page的用法示例。


在下文中一共展示了Page.MapPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetThemeNames

		public static string[] GetThemeNames(Page page)
		{
			if(page == null)
				throw new ArgumentNullException("page");

			return GetThemeNames(page.MapPath("~/themes"));
		}
开发者ID:Flagwind,项目名称:Zongsoft.Web,代码行数:7,代码来源:ThemeUtility.cs

示例2: LoadFileContents

        /// <summary>
        /// Loads the Javascript file contents onto the page
        /// using the given url which must refer to this site.
        /// 
        /// If the url starts with "http://" or "https://"
        /// then this method calls LoadFileReference instead.
        /// </summary>
        /// <param name="page">The page on which to load</param>
        /// <param name="url">The url of the file</param>
        /// <param name="addScriptTag">If true then add script tags</param>
        public static void LoadFileContents(Page page, string url, bool addScriptTag)
        {
            if (url.StartsWith(FileTools.httpStart))
            {
                LoadFileReference(page, url);
                return;
            }

            if (url.StartsWith(FileTools.httpsStart))
            {
                LoadFileReference(page, url);
                return;
            }

            ClientScriptManager clientscriptmanager = page.ClientScript;
            Type type = page.GetType();

            if (!clientscriptmanager.IsClientScriptBlockRegistered(type, url))
            {
                string filepath = page.MapPath(url);
                string contents = FileTools.GetFileAsText(filepath);
                LoadScriptString(page, url, contents, addScriptTag);
            }
        }
开发者ID:rewanth21,项目名称:freetime,代码行数:34,代码来源:Javascript.cs

示例3: PieChart


//.........这里部分代码省略.........
                strDataName += str[i].ToString() + "\t";
                strData += count[i].ToString() + "\t";
            }
            strDataName = strDataName.Substring(0, strDataName.Length - 1);
            strData = strData.Substring(0, strData.Length - 1);

            //设置图表类型,本例使用饼
            switch (pie.PicChartType)
            {
                case PieType.Pie:
                    mychart.Type = ChartChartTypeEnum.chChartTypePie;
                    break;
                case PieType.Pie3D:
                    mychart.Type = ChartChartTypeEnum.chChartTypePie3D;
                    break;
                case PieType.Exploded:
                    mychart.Type = ChartChartTypeEnum.chChartTypePieExploded;
                    break;
                case PieType.Exploded3D:
                    mychart.Type = ChartChartTypeEnum.chChartTypePieExploded3D;
                    break;
                default:
                    mychart.Type = ChartChartTypeEnum.chChartTypePie;
                    break;
            }

            //设置图表的一些属性
            //是否需要图例
            mychart.HasLegend = true;
            //是否需要主题
            mychart.HasTitle = true;

            //主题内容
            mychart.Title.Caption = pie.ChartTitle;
            mychart.Title.Font.Size = pie.ChartTitleSize;
            mychart.Title.Font.Bold = pie.ChartTitleBold;
            mychart.Title.Font.Color = pie.ChartTitleColor;
            switch (pie.LegendPosition)
            {
                case LegendPosition.Top:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionTop;
                    break;
                case LegendPosition.Bottom:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionBottom;
                    break;
                case LegendPosition.Left:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionLeft;
                    break;
                case LegendPosition.Right:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
                    break;
                default:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
                    break;
            }

            mychart.Legend.Interior.Color = pie.LegendBgColor;
            mychart.Legend.Font.Bold = pie.LegenFontBold;
            mychart.Legend.Font.Size = pie.LegendFontSize;
            mychart.Legend.Border.Color = pie.LegendBorderColor;

            //添加图表块
            mychart.SeriesCollection.Add(0);
            //设置图表块的属性
            //分类属性
            mychart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories,
            (int)ChartSpecialDataSourcesEnum.chDataLiteral, strDataName);
            //mychart.SeriesCollection[0].Interior.Color = "#C1DBEE";
            //mychart.SeriesCollection[1].Interior.Color = "#D1A00B";

            //值属性
            mychart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues,
            (int)ChartSpecialDataSourcesEnum.chDataLiteral, strData);
            for (int j = 0; j < mychart.SeriesCollection[0].Points.Count; j++)
            {
                mychart.SeriesCollection[0].Points[j].Border.Color = pie.SeriesCollectionBorderColor;
                if (pie.DataColor != null)
                {
                    mychart.SeriesCollection[0].Points[j].Interior.Color = pie.DataColor[j].ToString();
                }
            }

            //显示百分比
            ChDataLabels mytb = mychart.SeriesCollection[0].DataLabelsCollection.Add();
            mytb.HasPercentage = pie.HasPercentage;
            mytb.Font.Color = pie.DataFontColor;
            mytb.Font.Size = pie.DataFontSize;
            mytb.HasValue = true;
            //生成图片
            //劉宏哲修改,先删除文件再创建文件。解决第一次生成图片以后,再次生成报错。时间:2010-04-21 9:44。
            string path = page.MapPath(".") + @"\" + pie.PicName + ".gif";
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            mychartSpace.ExportPicture(path, "gif", pie.ChartWidth, pie.ChartHeight);

            //返回图片路径
            return pie.PicName + ".gif" + "?temp=" + System.DateTime.Now.Ticks.ToString() + "";
        }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:101,代码来源:Chart.cs

示例4: GenerateTheme

		public static bool GenerateTheme(Page page, string themeName)
		{
			if(page == null || string.IsNullOrWhiteSpace(themeName))
				return false;

			var resolver = Zongsoft.Web.Themes.ThemeResolver.GetResolver(page.MapPath("~/themes"));

			if(resolver == null)
				return false;

			var theme = resolver.Resolve(themeName);

			if(theme == null)
				return false;

			try
			{
				foreach(var include in theme.Includes)
				{
					GenerateComponent(include.Target, page);
				}

				page.Response.SetCookie(new HttpCookie(ThemeName, themeName));

				//返回成功
				return true;
			}
			finally
			{
				HashSet<string> temp;
				_pageLinks.TryRemove(page, out temp);
			}
		}
开发者ID:Flagwind,项目名称:Zongsoft.Web,代码行数:33,代码来源:ThemeUtility.cs

示例5: CreateBackImage

		/// <summary>
		/// 写入图像水印
		/// </summary>
		/// <param name="str">水印字符串</param>
		/// <param name="filePath">原图片位置</param>
		/// <param name="savePath">水印加入后的位置</param>
		/// <returns></returns>
		public static string CreateBackImage( Page pageCurrent , string str , string filePath , string savePath , int x ,
									  int y ) {
			Image img = Image.FromFile( pageCurrent.MapPath( filePath ) );
			//创建图片
			Graphics graphics = Graphics.FromImage( img );
			//指定要绘制的面积
			graphics.DrawImage( img , 0 , 0 , img.Width , img.Height );
			//定义字段和画笔
			Font font = new Font( "黑体" , 16 );
			Brush brush = new SolidBrush( Color.Yellow );
			graphics.DrawString( str , font , brush , x , y );
			//保存并输出图片
			img.Save( pageCurrent.MapPath( savePath ) , ImageFormat.Jpeg );
			return savePath;
		}
开发者ID:kisflying,项目名称:kion,代码行数:22,代码来源:UIHelper.cs

示例6: SearchTreeMarkup

        /// <summary>
        /// Returns the markup from the search 
        /// of either the public directories
        /// or all directories that start at
        /// tildeDirectoryPath.
        /// </summary>
        /// <param name="page">
        ///     The page calling this method</param>
        /// <param name="tildeDirectoryPath">
        ///     The root of the directory tree to search</param>
        /// <param name="pattern">
        ///     The search pattern</param>
        /// <param name="isRegex">
        ///     Is the pattern a regular expression?</param>
        /// <param name="ignoreCase">
        ///     Ignore case in the search?</param>
        /// <param name="statistics">
        ///     Include file statistics markup?</param>
        /// <param name="download">
        ///     Include download button markup?</param>
        /// <param name="onlyPublic">
        ///     Whether or not to restrict to public directories</param>
        public static string SearchTreeMarkup(Page page,
            string tildeDirectoryPath,
            string pattern,
            bool isRegex,
            bool ignoreCase,
            bool statistics,
            bool download,
            bool onlyPublic)
        {
            StringBuilder builder = new StringBuilder();

            int n = tildeDirectoryPath.Length;

            if (tildeDirectoryPath[n - 1] != SourceTools.slash)
                tildeDirectoryPath = tildeDirectoryPath + SourceTools.slash;

            string directoryPath = page.MapPath(tildeDirectoryPath);

            string rootPath = FileTools.GetRoot(page);

            List<string> directoryList =
                SourceTools.MakeDirectoryList(directoryPath, onlyPublic);

            List<string> tildeDirectoryList =
                FileTools.GetTildePaths(rootPath, directoryList);

            foreach (string tdp in tildeDirectoryList)
            {
                string markup =
                    SearchDirectoryMarkup(page, tdp, pattern,
                        isRegex, ignoreCase, statistics, download, onlyPublic);

                if (!StringTools.IsTrivial(markup))
                    builder.Append(markup);
            }

            return builder.ToString();
        }
开发者ID:AkaiTsuki,项目名称:cs5610,代码行数:60,代码来源:SearchTools.cs

示例7: SearchDirectoryMarkup

        /// <summary>
        /// Returns the markup from the search 
        /// of a directory given its tilde path.
        /// 
        /// Preconditions: The page that calls this method must:
        /// 
        ///   1. Have executed the call
        /// 
        ///        SourceTools.LoadCSSandJavascript(this);
        ///     
        ///      during the initial call to PageLoad. 
        /// 
        ///   2. Be able to guarantee that the directory is OK to serve
        ///      in context.
        /// </summary>
        /// <param name="page">
        ///     The page calling this method</param>
        /// <param name="tildeDirectoryPath">
        ///     The directory to search</param>
        /// <param name="pattern">
        ///     The search pattern</param>
        /// <param name="isRegex">
        ///     Is the pattern a regular expression?</param>
        /// <param name="ignoreCase">
        ///     Ignore case in the search?</param>
        /// <param name="statistics">
        ///     Include file statistics markup?</param>
        /// <param name="download">
        ///     Include download button markup?</param>
        /// <param name="onlyPublic">
        ///     Whether or not to restrict to public directories</param>
        public static string SearchDirectoryMarkup(Page page,
            string tildeDirectoryPath,
            string pattern,
            bool isRegex,
            bool ignoreCase,
            bool statistics,
            bool download,
            bool onlyPublic)
        {
            int n = tildeDirectoryPath.Length;

            if (tildeDirectoryPath[n - 1] != SourceTools.slash)
                tildeDirectoryPath = tildeDirectoryPath + SourceTools.slash;

            StringBuilder builder = new StringBuilder();

            string directoryPath = page.MapPath(tildeDirectoryPath);

            DirectoryInfo directory = new DirectoryInfo(directoryPath);

            FileInfo[] files = directory.GetFiles();

            int m = files.Length;

            for (int i = 0; i < m; i++)
            {
                string tildeFilePath = tildeDirectoryPath + files[i].Name;

                string markup = SearchFileMarkup(page, tildeFilePath, pattern,
                    isRegex, ignoreCase, statistics, download, false, onlyPublic);

                if (!StringTools.IsTrivial(markup))
                {
                    builder.Append(markup);
                    builder.Append("<hr />\n");
                }
            }

            return builder.ToString();
        }
开发者ID:AkaiTsuki,项目名称:cs5610,代码行数:71,代码来源:SearchTools.cs

示例8: FileData

 /// <summary>
 /// Returns a list of lines in a file.
 /// 
 /// If trim is true then all lines are trimmed and any lines
 /// that then have length 0 are discarded.
 /// 
 /// If trim is false then all lines are added unchanged.
 /// 
 /// The file name may be given by a web file relative path
 /// to the given page or by a tilde file path.
 /// 
 /// This method is a generalization of a method originally
 /// in the Teaching Preferences web application.
 /// 
 /// If an exception occurs, a list with 0 items will be
 /// returned.
 /// </summary>
 /// <param name="page">The page calling this method</param>
 /// <param name="filename">The web page relative file name</param>
 /// <returns>The list of the non-empty lines</returns>
 public static List<string> FileData(Page page, string filename, bool trim)
 {
     return FileDataAbsolutePath(page.MapPath(filename), trim);
 }
开发者ID:rewanth21,项目名称:freetime,代码行数:24,代码来源:FileTools.cs

示例9: LancementDuProgramme

        public void LancementDuProgramme(bool premiereFois, XHtmlParametresLancement parametresRecus, Page page, object sender, System.EventArgs e)
        {
            PageWeb = page;
            if (page == null)
            {
                string message = "page null dans XWebPageLoad";
                throw new NullReferenceException(message);
            }

            string parametres = null;
            //	on recupere la session
            SessionWeb = (int)page.Session["SessionDivaltoWeb"];
            //	la première fois

            if (page.Session == null)
            {
                string message = "page.Session null dans XWebPageLoad";
                throw new NullReferenceException(message);
            }
            if (PageWeb.Request == null)
            {
                string message = "PageWeb.Request null dans XWebPageLoad";
                throw new NullReferenceException(message);
            }

            //			if (page.Session.IsNewSession)
            if (premiereFois)
            {
                //	on recupere les paramètres dans la page générique
                Label cparametres = (Label)page.FindControl("parametres");

                if (cparametres != null)
                    parametres = cparametres.Text +
                                     "<BrowserName>" + PageWeb.Request.Browser.Browser +
                                     "<BrowserVersion>" + PageWeb.Request.Browser.Version +
                                     "<HomeDirectory>" + page.MapPath(page.TemplateSourceDirectory) +  // bh23052006
                                     "<HostName>" + page.Request.UserHostName +							// bh24052007
                                     "<HostAddress>" + page.Request.UserHostAddress +						// bh24052007
                                     "<UserAgent>" + page.Request.UserAgent;								// bh24052007

                foreach (string lang in page.Request.UserLanguages)
                    parametres += ("<Language>" + lang);

                //	ajout de l'url
                parametres += this.CreerHmpQueryString(PageWeb.Request);

                //	ajout des cookies
                parametres += ("<cookies>" + this.CreerHmpCookies(PageWeb.Request));

                //	on lance le programme et on attend la reponse
                //				DialogueX2Y.WebRunProgram(SessionWeb, parametres, out codeecran);

                /////////////////////////////////////////////////
                // Parametres en dur, en attendant mieux
                {
                    ushort numeroExecutable = 0;
                    string domaine = "";
                    string utilisateur = "hao";
                    string motDePasse = "hao";
                    string utilisateurHarmony = "root";
                    string motDePasseHarmony = "hao";
                    string programme = parametresRecus.program; //  "tablohtml5.dhop";  // "testhtml5.dhop";
                    string fenetreMere = "";
                    string autres = "";
                    string numeroMachine = "123456";
                    string Environnement = "";
                    string CodeLangueEcran = "";
                    string CodeLangueImprimante = "";
                    string HARMONY_PARAMetAutres = "";
                    int UserPointExclamation = 0;
                    string messageErreur;

                    {
                        //						DVBuffer bufferReception;
                        //						byte[] reception;
                        messageErreur = "";
                        string mpw = "";
                        string mph = "";

                        if (DialogueX2Y.VerifierSiServeurArrete(utilisateurHarmony) == false)
                        {
                            //!!!!!!!!!!!!!!!!!!! a finaliser
                            messageErreur = "Le service DhsTerminalServer est arrêté";
                            SessionWeb = -1;
                            return;
                        }

                        //SessionWeb = DialogueX2Y.WebOpenSession(); deja fait dans Session_Start

                        // A revoir !!!!!!!!!!!!!!!!!!!!!!!!!
                        mpw = motDePasse;
                        mph = motDePasseHarmony;
                        //if (motDePasse != "")
                        //	mpw = DVCrypt.Decrypter(motDePasse, DVCrypt.CalculerCle(utilisateur));
                        //if (motDePasseHarmony != "")
                        //	mph = DVCrypt.Decrypter(motDePasseHarmony, DVCrypt.CalculerCle(utilisateurHarmony));

                        // je considère que seul le transport local positionne ce flag
                        // cela permet de tester les autres transports en réel meme dans une seule machine
                        //----------------------------------------------------------------------------------
//.........这里部分代码省略.........
开发者ID:shinesoleil,项目名称:widgetJquery,代码行数:101,代码来源:XHtmlApplication.cs

示例10: GetDictionaryFile

        /// <summary>
        /// This single argument helper operation retrieves the base dictionary
        /// input file and fills and sets the maximum word length.
        /// </summary>
        /// <param name="refPage">Reference to the calling ASP.NET System.Web.UI.Page</param>
        /// <param name="dictionaryNum">Specifies which dictionary to use.</param>
        private void GetDictionaryFile( Page refPage, int dictionaryNum )
        {
            usedWords = new SortedList();
            for(int x = 'a'; x < (int)('z' + 1); x++ )
                usedWords.Add( (char)x, 0 );
            dictionarySize = 0;
            nextWord = "";

            pageRef = refPage;
            if( file == null )
            {	/* This will successfully access the input files if the IIS web server
                 * is running frontpage server extensions on thepuzzler_3dstyle web folder.
                 */
                file = new string [] { "base_dictionary#1.txt", "base_dictionary#2.txt",
                                       "base_dictionary#3.txt", "base_dictionary#4.txt" };

                string path = Path.GetFullPath( string.Concat( refPage.MapPath( "~" ), @"\", file[dictionaryNum - 1] ) );
                //try
                //{
                //    reader = new StreamReader( path );
                //    file = null;
                //}
                //catch( DirectoryNotFoundException ) {}
                if( reader == null )
                {
                    try
                    {
                        //file = new string []
                        //{	/* This will successfully access the input files if the IIS web server
                        //    * is running file share access on thepuzzler_3dstyle web folder.
                        //    */
                        //    @"\\localhost\thepuzzler_3dstyle\base_dictionary#1.txt",
                        //    @"\\localhost\thepuzzler_3dstyle\base_dictionary#2.txt",
                        //    @"\\localhost\thepuzzler_3dstyle\base_dictionary#3.txt",
                        //    @"\\localhost\thepuzzler_3dstyle\base_dictionary#4.txt"
                        //};
                        //reader = new StreamReader( file[dictionaryNum - 1] );
                        reader = new StreamReader( path );
                        file = null;
                    }
                    catch( System.IO.FileNotFoundException error )
                    {
                        Trace.WriteLine( "You must make absolutely sure that the files base_dictionary#1.txt," +
                            "base_dictionary#2.txt, base_dictionary#3.txt, and base_dictionary#4.txt are " +
                            "in the web folder http://<YourServersName>/thepuzzler_3dstyle/ !!" +
                            "\nMessage:\n" + error.ToString() );
                    }
                }
            }
            if( puzzle.GetUpperBound(0) + 1 > puzzle.GetUpperBound(1) + 1 &&
                puzzle.GetUpperBound(0) + 1 > puzzle.GetUpperBound(2) + 1 )
                maximumWordLength = puzzle.GetUpperBound(0) + 1;
            else if( puzzle.GetUpperBound(1) + 1 > puzzle.GetUpperBound(0) + 1 &&
                puzzle.GetUpperBound(1) + 1 > puzzle.GetUpperBound(2) + 1)
                maximumWordLength = puzzle.GetUpperBound(1) + 1;
            else
                maximumWordLength = puzzle.GetUpperBound(2) + 1;
        }
开发者ID:mklump,项目名称:ThePuzzler-3DStyle,代码行数:64,代码来源:DictionaryCreator.cs

示例11: sendMail

        public static bool sendMail(string body, string subject, string toUser, Page page, string fileAttachment, MemoryStream stream)
        {
            // mail parameters
            string fromEmail = "[email protected]";
            if (BusinessLogicLayer.Common.FromEmail != null)
                fromEmail = BusinessLogicLayer.Common.FromEmail.ToString();

            string MailServer = "smtp.gmail.com";
            MailServer = BusinessLogicLayer.Common.MailServer;

            SmtpClient client = new SmtpClient(MailServer);
            NetworkCredential cred = new NetworkCredential(BusinessLogicLayer.Common.FromEmail, BusinessLogicLayer.Common.MailPassowrd);
            client.EnableSsl = BusinessLogicLayer.Common.EnableSSL.ToString().ToLowerInvariant() == "true" ? true : false;
            // Add credentials if the SMTP server requires them.
            if (!BusinessLogicLayer.Common.MailPort.ToString().Equals(""))
                client.Port = Convert.ToInt32(BusinessLogicLayer.Common.MailPort.ToString());

            client.UseDefaultCredentials = false;
            client.Credentials = cred;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            MailMessage message = new MailMessage();
            message.From = new MailAddress(fromEmail);
            message.Subject = subject;
            //message.Body = body;
            message.IsBodyHtml = true;

            //if (MyValidation.isEmail(toUser))
            message.To.Add(toUser);
            AlternateView htmlView = AlternateView.CreateAlternateViewFromString(body, null, "text/html");
            //LinkedResource logo = new LinkedResource(page.MapPath("~/images/bg-top_email.jpg"));
            LinkedResource logo = new LinkedResource(page.MapPath("~/images/bg-top_email.jpg"));
            logo.ContentId = "conferencelogo";
            htmlView.LinkedResources.Add(logo);
            message.AlternateViews.Add(htmlView);
            //if(stream != null)
            //{

            //    Attachment a = new Attachment(stream, "application/pdf");
            //    a.ContentId = "Abstract Submission";
            //    message.Attachments.Add(a);
            //}
            //message.Bcc.Add(toUser);
            // Create a message and set up the recipients.

            try
            {
                // Thread t = new Thread();
                client.Send(message);
            }
            catch (Exception ex)
            {
                // error loading template file
                //throw new ErrorException(ex.Message);
                return false;
            }

            // also send internal msg
            //UserMsg msg = new UserMsg();
            //msg.FromUserID = SManager.getUserID(currentPage);
            //msg.MsgTopic = MyMsgTopic.TermEval;
            //msg.Msg = body;
            //try
            //{
            //    MsgManager.sendBroadCastMsg(usrList, msg);
            //}
            //catch (Exception ex)
            //{
            //    // error loading template file
            //    //throw new ErrorException(string.Format("Can't send message to ({0})", msg.ToUserID));
            //}
            return true;
        }
开发者ID:ramyothman,项目名称:RBM,代码行数:72,代码来源:EmailManager.cs

示例12: DownloadFile

        public static bool DownloadFile(Page page, HttpResponse response, HttpSessionState userSession)
        {
            Regex RE = new Regex(@"[,]+");
            string[] tImagePathDef = RE.Split((string)userSession[IGSMRequest.IGSMREQUEST_PARAM_LISTPATH]);

            string sImageFileName = Path.GetFileName(tImagePathDef[0]);
            string sFilePath = page.MapPath(tImagePathDef[0]);
            response.ContentType = "application/octet-stream";
            response.AddHeader("Content-Disposition", "attachment; filename=" + sImageFileName);
            response.WriteFile(sFilePath);
            userSession.Remove(IGSMRequest.IGSMREQUEST_PARAM_LISTPATH);
            return true;
        }
开发者ID:JBetser,项目名称:Imagenius_SDK,代码行数:13,代码来源:IGPEWebServer.cs

示例13: ShowProgBar

		/// <summary>
		/// 主要实现进度条的功能,这段代码的调用就要实现进度的调度
		/// 实现主要过程
		/// default.aspx.cs是调用页面
		/// 放入page_load事件中
		///            UIHelper myUI = new UIHelper();
		///            Response.Write(myUI.ShowProgBar(this.Page,"../JS/progressbar.htm"));
		///            Thread thread = new Thread(new ThreadStart(ThreadProc));
		///            thread.Start();
		///            LoadData();//load数据 
		///            thread.Join();
		///            Response.Write("OK");
		/// 
		/// 其中ThreadProc方法为
		///     public void ThreadProc()
		///    {
		///    string strScript = "<script>setPgb('pgbMain','{0}');</script>";
		///    for (int i = 0; i <= 100; i++)
		///     {
		///        System.Threading.Thread.Sleep(10);
		///        Response.Write(string.Format(strScript, i));
		///        Response.Flush();
		///     }
		///    }
		/// 其中LoadData()
		///     public void LoadData()
		///        {
		///            for (int m = 0; m < 900; m++)
		///            {
		///                for (int i = 0; i < 900; i++)
		///                {
		///
		///                }
		///            }
		///        }
		/// 
		/// </summary>
		/// <param name="pageCurrent"></param>
		/// <param name="ShowProgbarScript"></param>
		/// <returns></returns>
		public static string ShowProgBar( Page pageCurrent , string ShowProgbarScript ) {
			StreamReader sr = new StreamReader( pageCurrent.MapPath( ShowProgbarScript ) , Encoding.Default );
			StringBuilder sb = new StringBuilder();
			string line;
			try {
				while ( ( line = sr.ReadLine() ) != null ) {
					sb.AppendLine( line );
				}
				sr.Close();
			}
			catch ( Exception ex ) {
				throw new Exception( ex.Message );
			}
			//pageCurrent.ClientScript.RegisterStartupScript(pageCurrent.GetType(),
			//            System.Guid.NewGuid().ToString(), sb.ToString());
			return sb.ToString();
		}
开发者ID:kisflying,项目名称:kion,代码行数:57,代码来源:UIHelper.cs

示例14: PlayMediaFile

		/// <summary>
		/// 调用Media播放mp3或电影文件
		/// </summary>
		/// <param name="pageCurrent">
		/// 当前的页面对象
		/// </param>
		/// <param name="PlayFilePath">
		/// 播放文件的位置
		/// </param>
		/// <param name="MediajavascriptPath">
		/// Mediajavascript的脚本位置
		/// </param>
		/// <param name="enableContextMenu">
		/// 是否可以使用右键
		/// 指定是否使右键菜单有效
		/// 指定右键是否好用,默认为0不好用
		/// 指定为1时就是好用
		/// </param>
		/// <param name="uiMode">
		/// 播放器的大小显示
		/// None,mini,或full,指定Windows媒体播放器控制如何显示
		/// </param>
		public static string PlayMediaFile( Page pageCurrent ,
									string PlayFilePath , string MediajavascriptPath ,
									string enableContextMenu , string uiMode ) {
			StreamReader sr = new StreamReader( pageCurrent.MapPath( MediajavascriptPath ) );
			StringBuilder sb = new StringBuilder();
			string line;
			try {
				while ( ( line = sr.ReadLine() ) != null ) {
					sb.AppendLine( line );
				}
				sr.Close();
			}
			catch ( Exception ex ) {
				throw new Exception( ex.Message );
			}
			sb.Replace( "$URL" , pageCurrent.MapPath( PlayFilePath ) );
			sb.Replace( "$enableContextMenu" , enableContextMenu );
			sb.Replace( "$uiMode" , uiMode );
			//pageCurrent.ClientScript.RegisterStartupScript(pageCurrent.GetType(),
			//            System.Guid.NewGuid().ToString(), sb.ToString());
			return sb.ToString();
		}
开发者ID:kisflying,项目名称:kion,代码行数:44,代码来源:UIHelper.cs

示例15: ColumnChart

        public string ColumnChart(Column column, Page page)
        {
            //创建图表空间
            ChartSpace mychartSpace = new ChartSpace();

            //在图表空间内添加一个图表对象
            ChChart mychart = mychartSpace.Charts.Add(0);
            mychartSpace.Border.Color = column.ChartBorderColor;
            //设置图表类型,本例使用柱形
            mychart.Type = ChartChartTypeEnum.chChartTypeColumnClustered;
            //设置图表的一些属性
            //是否需要图例
            mychart.HasLegend = true;
            //是否需要主题
            mychart.HasTitle = true;
            //主题内容
            mychart.Title.Caption = column.ChartTitle;
            mychart.Title.Font.Size = column.ChartTitleSize;
            mychart.Title.Font.Bold = column.ChartTitleBold;

            switch (column.LegendPosition)
            {
                case LegendPosition.Top:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionTop;
                    break;
                case LegendPosition.Bottom:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionBottom;
                    break;
                case LegendPosition.Left:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionLeft;
                    break;
                case LegendPosition.Right:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
                    break;
                default:
                    mychart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
                    break;
            }
            mychart.Legend.Interior.Color = column.LegendBgColor;
            mychart.Legend.Font.Size = column.LegendFontSize;
            mychart.Legend.Border.Color = column.LegendBorderColor;

            //设置x,y坐标

            mychart.Axes[1].HasTitle = column.ShowYAxes;
            mychart.Axes[1].Title.Caption = column.YAxesCaption;
            mychart.Axes[1].Title.Font.Size = 10;

            mychart.Axes[0].HasTitle = column.ShowXAxes;
            mychart.Axes[0].Title.Caption = column.XAxesCaption;
            mychart.Axes[0].Font.Name = "宋体";
            mychart.Axes[0].Font.Size = 10;

            string seriesName = "";
            string strValue = "";
            string category = "";

            for (int i = 0; i < column.SeriesNames.Length; i++)
            {
                seriesName = column.SeriesNames[i];
                strValue = "";
                category = "";
                for (int j = 0; j < column.Values[i].Length; j++)
                {
                    strValue += column.Values[i][j].ToString() + "\t";
                }

                for (int j = 0; j < column.Categorys.Length; j++)
                {
                    category += column.Categorys[j] + "\t";
                }
                mychart.SeriesCollection.Add(i);
                mychart.SeriesCollection[i].SetData(ChartDimensionsEnum.chDimSeriesNames, (int)ChartSpecialDataSourcesEnum.chDataLiteral, seriesName);
                mychart.SeriesCollection[i].SetData(ChartDimensionsEnum.chDimCategories, (int)ChartSpecialDataSourcesEnum.chDataLiteral, category);
                mychart.SeriesCollection[i].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue);
                mychart.SeriesCollection[i].DataLabelsCollection.Add();
                mychart.SeriesCollection[i].DataLabelsCollection[0].HasValue = true;
                //mychart.SeriesCollection.Add(1);

                //if (column.DataColor != null)
                //{
                //    mychart.SeriesCollection[i].Points[0].Interior.Color = column.DataColor[i].ToString();
                //}
            }

            //生成图片
            //劉宏哲修改,先删除文件再创建文件。解决第一次生成图片以后,再次生成报错。时间:2010-04-21 9:44。

            string path = page.MapPath(".") + @"\" + column.PicName + ".gif";
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            mychartSpace.ExportPicture(path, "gif", column.ChartWidth, column.ChartHeight);

            //返回图片路径
            return column.PicName + ".gif" + "?temp=" + System.DateTime.Now.Ticks.ToString() + "";
        }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:98,代码来源:Chart.cs


注:本文中的System.Web.UI.Page.MapPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。