• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# System类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System的典型用法代码示例。如果您正苦于以下问题:C# System类的具体用法?C# System怎么用?C# System使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System类属于命名空间,在下文中一共展示了System类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConvertBack

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            float floatValue;
            float.TryParse((string)value,System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.InvariantCulture, out floatValue);

            return ConvertBack(floatValue, (string)parameter);
        }
开发者ID:hotzenklotz,项目名称:BrewingApp,代码行数:7,代码来源:WeightConverter.cs


示例2: Window_Closing

 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     var manager = new TuinManager();
     foreach (Leverancier lev in levOb)
     {
         if (lev.Changed == true)
             GewijzigdeLeveranciers.Add(lev);
         lev.Changed = false;
     }
     if (OudeLeveranciers.Count() != 0 || NieuweLeveranciers.Count() != 0 || GewijzigdeLeveranciers.Count() != 0)
     {
         if (MessageBox.Show("Wilt u alles wegschrijven naar de database ?", "Opslaan", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
         {
             if (OudeLeveranciers.Count() != 0)
                 manager.SchrijfVerwijderingen(OudeLeveranciers);
             else if (NieuweLeveranciers.Count() != 0)
                 manager.SchrijfToevoegingen(NieuweLeveranciers);
             else if (GewijzigdeLeveranciers.Count() != 0)
                 manager.SchrijfWijzigingen(GewijzigdeLeveranciers);
         }
     }
     OudeLeveranciers.Clear();
     NieuweLeveranciers.Clear();
     GewijzigdeLeveranciers.Clear();
 }
开发者ID:kurtkreemers,项目名称:AdoTaken,代码行数:25,代码来源:MainWindow.xaml.cs


示例3: OnActionExecuting

        public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
        {

            if (actionContext.ModelState.IsValid) return;

            var errors = actionContext.ModelState
                .Where(e => e.Value.Errors.Count > 0)
                .Select(e => new Error
                {
                    Name = e.Key,
                    Message = e.Value.Errors.First().ErrorMessage ?? e.Value.Errors.First().Exception.Message
                }).ToArray();

            var strErrors = new StringBuilder();
            foreach (var error in errors)
            {
                var errorM = String.IsNullOrEmpty(error.Message) ? "Invalid Value" : error.Message;
                strErrors.Append(string.Format("[{0}]:{{{1}}}/", error.Name, errorM));
            }
            actionContext.Response = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.BadRequest,
                ReasonPhrase = strErrors.ToString(),
                Content = new StringContent(strErrors.ToString())
            };
        }
开发者ID:victorxata,项目名称:bartrade.rocks,代码行数:26,代码来源:ValidationAttribute.cs


示例4: OnBackKeyPress

        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            base.OnBackKeyPress(e);

            var isHidden = false;

            try
            {
                if (_avatarControl != null)
                isHidden = _avatarControl.IsHidden;
            }
            catch (Exception)
            {
                Application.Current.Terminate();
            }

            if (isHidden)
            {
                e.Cancel = true;

                PopupManager.Instance.Hide();
            }
            else 
                Application.Current.Terminate();
        }
开发者ID:kiendev,项目名称:FarjiChat,代码行数:25,代码来源:Login.xaml.cs


示例5: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            App.SelectedRoom = string.Empty;

            if (IsolatedStorageSettings.ApplicationSettings.Contains("NickName"))
            {
                TxtNickname.Text = IsolatedStorageSettings.ApplicationSettings["NickName"].ToString();
                TxtAge.Text = IsolatedStorageSettings.ApplicationSettings["Age"].ToString();
                TxtAvatarCode.Text = IsolatedStorageSettings.ApplicationSettings["AvatarCode"].ToString();

                _gender = IsolatedStorageSettings.ApplicationSettings["Gender"].ToString();
                var nickColor = IsolatedStorageSettings.ApplicationSettings["NickColor"] is Color ? (Color)IsolatedStorageSettings.ApplicationSettings["NickColor"] : new Color();

                _viewModel.NickColor = new SolidColorBrush(nickColor);

                if (_gender.Equals("m"))
                {
                    BtnMale.Background = (SolidColorBrush)Application.Current.Resources["ButtonBackground"];
                    BtnFemale.Background = (SolidColorBrush)Application.Current.Resources["TransparentBackground"];
                }
                else if (_gender.Equals("f"))
                {
                    BtnMale.Background = (SolidColorBrush) Application.Current.Resources["TransparentBackground"];
                    BtnFemale.Background = (SolidColorBrush) Application.Current.Resources["ButtonBackground"];
                }
                else
                {
                    BtnMale.Background = (SolidColorBrush)Application.Current.Resources["TransparentBackground"];
                    BtnFemale.Background = (SolidColorBrush)Application.Current.Resources["TransparentBackground"];
                }
            }
        }
开发者ID:kiendev,项目名称:FarjiChat,代码行数:34,代码来源:Login.xaml.cs


示例6: drawLine

        public static void drawLine(Vector3 pos1, Vector3 pos2, int bold, System.Drawing.Color color)
        {
            var wts1 = Drawing.WorldToScreen(pos1);
            var wts2 = Drawing.WorldToScreen(pos2);

            Drawing.DrawLine(wts1[0], wts1[1], wts2[0], wts2[1], bold, color);
        }
开发者ID:sosll2005,项目名称:LeagueRepo,代码行数:7,代码来源:Ahri.cs


示例7: ArrayBinding_Load

        private void ArrayBinding_Load(object sender, System.EventArgs e)
        {
            // Access database
            System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm mainForm = (System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm)this.ParentForm;

            // The XML document
            string fileNameString = mainForm.applicationPath + "\\data\\data.xml";
            string fileNameSchema = mainForm.applicationPath + "\\data\\data.xsd";

            // Initializes a new instance of the DataSet class
            DataSet custDS = new DataSet();

            // Reads an XML schema into the DataSet.
            custDS.ReadXmlSchema( fileNameSchema );

            // Reads XML schema and data into the DataSet.
            custDS.ReadXml( fileNameString );

            // Initializes a new instance of the DataView class
            DataView firstView = new DataView(custDS.Tables[0]);

            Chart1.Series.Clear();
            // Since the DataView implements and IEnumerable, pass the reader directly into
            // the DataBindTable method with the name of the column used for the X value.
            Chart1.DataBindTable(firstView, "Name");

            // Set series appearance
            Chart1.Series[0].ChartType = SeriesChartType.Bar;
            Chart1.Series[0].Font = new Font("Trebuchet MS", 8);
            Chart1.Series[0].Color = System.Drawing.Color.FromArgb(220, 224,64,10);
            Chart1.Series[0].BorderWidth = 0;
        }
开发者ID:zhaohengyi,项目名称:WinChartControlerSamples,代码行数:32,代码来源:XMLData.cs


示例8: ExportData

        public ExportData(System.Data.DataTable dt, string location)
        {
            //instantiate excel objects (application, workbook, worksheets)
            excel.Application XlObj = new excel.Application();
            XlObj.Visible = false;
            excel._Workbook WbObj = (excel.Workbook)(XlObj.Workbooks.Add(""));
            excel._Worksheet WsObj = (excel.Worksheet)WbObj.ActiveSheet;

            //run through datatable and assign cells to values of datatable

                int row = 1; int col = 1;
                foreach (DataColumn column in dt.Columns)
                {
                    //adding columns
                    WsObj.Cells[row, col] = column.ColumnName;
                    col++;
                }
                //reset column and row variables
                col = 1;
                row++;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //adding data
                    foreach (var cell in dt.Rows[i].ItemArray)
                    {
                        WsObj.Cells[row, col] = cell;
                        col++;
                    }
                    col = 1;
                    row++;
                }
                WbObj.SaveAs(location);
        }
开发者ID:MattPaul25,项目名称:WebsiteChecker,代码行数:33,代码来源:ExportData.cs


示例9: GetSelectListItems

        public IEnumerable<SelectListItem> GetSelectListItems(System.Web.Routing.RequestContext requestContext, string filter = null)
        {
            var siteName = requestContext.GetRequestValue("siteName");

            var site = new Site(siteName).AsActual();

            IEnumerable<Page> pageList = new List<Page>();

            var rootPages = Kooboo.CMS.Sites.Services.ServiceFactory.PageManager.All(site, null);

            pageList = rootPages.ToList();

            foreach (var r in rootPages)
            {
                this.GenerateList(site, r, ref pageList);
            }

            if (filter == null)
            {
                return null;
            }

            var result = pageList.Where(o => o.VirtualPath.StartsWith(filter, StringComparison.OrdinalIgnoreCase)).Select(o => new SelectListItem { Text = o.VirtualPath, Value = o.VirtualPath });

            return result;
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:26,代码来源:CustomError_Metadata.cs


示例10: OnMouseMove

 public void OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     var mouseState = Mouse.GetState();
     var keyboardState = Keyboard.GetState();
     var currentMouseCoordinate = new Vector2(e.X, e.Y);
     if (keyboardState.IsKeyDown(Key.ShiftLeft) && (mouseState[MouseButton.Middle] || (mouseState[MouseButton.Left] && keyboardState[Key.ControlLeft])))
     {
         var d = 5;
         var previousMouseWorldCoordinate = Maths.Project(ViewMatrix, Viewport.ProjectionMatrix, previousMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
         var mouseWorldCoordinate = Maths.Project(ViewMatrix, ProjectionMatrix, currentMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
         var delta = mouseWorldCoordinate - previousMouseWorldCoordinate;
         delta *= d;
         panTrack.Update(delta.X, delta.Y);
     }
     else if (keyboardState.IsKeyDown(Key.AltLeft) && (mouseState[MouseButton.Middle] || (mouseState[MouseButton.Left] && keyboardState[Key.ControlLeft])))
     {
         var previousMouseWorldCoordinate = Maths.Project(ViewMatrix, Viewport.ProjectionMatrix, previousMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
         var mouseWorldCoordinate = Maths.Project(ViewMatrix, ProjectionMatrix, currentMouseCoordinate, (Rectangle)Viewport, Maths.ProjectionTarget.View);
         var delta = mouseWorldCoordinate - previousMouseWorldCoordinate;
         delta *= 10;
         zoomTrack.Update(delta.Y);
     }
     else if (mouseState[MouseButton.Middle] || (mouseState[MouseButton.Left] && keyboardState[Key.ControlLeft]))
     {
         var delta = currentMouseCoordinate - previousMouseCoordinate;
         //delta *= 10;
         orbitTrack.Update(delta.X, delta.Y);
     }
     if (this.MouseMove != null) this.MouseMove(this, new MouseEventArgs(this, new Vector2(e.X, e.Y), default(Vector3), e.Button));
     previousMouseCoordinate = currentMouseCoordinate;
 }
开发者ID:jacksoncougar,项目名称:Moonfish-Editor,代码行数:31,代码来源:camera.cs


示例11: TouchUp

 public override void TouchUp(System.Drawing.PointF global, System.Drawing.PointF relative)
 {
     var videoControl = Source.FindParent<HotelVideoControl>() as HotelVideoControl;
     if (videoControl == null) return;
     videoControl.UnTouchSlider();
     base.TouchUp(global, relative);
 }
开发者ID:realsaraf,项目名称:eConcierge,代码行数:7,代码来源:TrackBarHandler.cs


示例12: Convert

        public object Convert(object[] values,
                              Type targetType,
                              object parameter,
                              System.Globalization.CultureInfo culture)
        {
            if (values == null ||
                values.Length != 2)
            {
                return Visibility.Collapsed;
            }

            if (values[0] is IEnumerable<string>)
            {
                var a = (IEnumerable<string>)values[0];
                var b = values[1];

                if (a.Contains(b) == true)
                {
                    return Visibility.Collapsed;
                }
            }
            else if (values[0] is ItemCollection)
            {
                var a = (ItemCollection)values[0];
                var b = values[1];

                if (a.Contains(b) == true)
                {
                    return Visibility.Collapsed;
                }
            }

            return Visibility.Visible;
        }
开发者ID:spitfire1337,项目名称:Borderlands-2-Save-Editor,代码行数:34,代码来源:ContainsToVisiblityConverter.cs


示例13: ConvertBack

 public object[] ConvertBack(object value,
                             Type[] targetTypes,
                             object parameter,
                             System.Globalization.CultureInfo culture)
 {
     throw new NotSupportedException();
 }
开发者ID:spitfire1337,项目名称:Borderlands-2-Save-Editor,代码行数:7,代码来源:ContainsToVisiblityConverter.cs


示例14: isBasicallyValidEmailAddress

 /// <summary> This implements only the most basic checking for an email address's validity -- that it contains
 /// an '@' contains no characters disallowed by RFC 2822. This is an overly lenient definition of
 /// validity. We want to generally be lenient here since this class is only intended to encapsulate what's
 /// in a barcode, not "judge" it.
 /// </summary>
 internal static bool isBasicallyValidEmailAddress(System.String email)
 {
     if (email == null)
     {
         return false;
     }
     bool atFound = false;
     for (int i = 0; i < email.Length; i++)
     {
         char c = email[i];
         if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9') && !isAtextSymbol(c))
         {
             return false;
         }
         if (c == '@')
         {
             if (atFound)
             {
                 return false;
             }
             atFound = true;
         }
     }
     return atFound;
 }
开发者ID:GeorgianCostea,项目名称:Xanders-Work,代码行数:30,代码来源:EmailDoCoMoResultParser.cs


示例15: Page_Load

 protected void Page_Load(object sender, System.EventArgs e)
 {
     try
     {
         myLoginID=Session["LoginID"].ToString();
     }
     catch
     {
     }
     if (myLoginID=="")
     {
         Response.Redirect("../Login.aspx");
     }
     intSubjectID=Convert.ToInt32(Request["SubjectID"]);
     strSubjectName=Convert.ToString(Request["SubjectName"]);
     labSubject.Text=Convert.ToString(Request["SubjectName"]);
     if (!IsPostBack)
     {
         //if (ObjFun.GetValues("select UserType from UserInfo where LoginID='"+myLoginID+"' and UserType=1 and (RoleMenu=1 or (RoleMenu=2 and Exists(select OptionID from UserPower where UserID=UserInfo.UserID and PowerID=3 and OptionID=3)))","UserType")!="1")
         //{
         //    Response.Write("<script>alert('�Բ�����û�д˲���Ȩ�ޣ�')</script>");
         //    Response.End();
         //}
         //else
         //{
             if (intSubjectID!=0)
             {
                 CountTestType(intSubjectID);//����������ͳ��
                 CountTestLore(intSubjectID);//������֪ʶ��ͳ��
                 CountTestDiff(intSubjectID);//�������Ѷ�ͳ��
             }
         //}
     }
 }
开发者ID:huaminglee,项目名称:NET-KaoShi,代码行数:34,代码来源:CountTestDist.aspx.cs


示例16: WriteException

        public static void WriteException(System.Exception e)
        {
            ArrayList messages = new ArrayList();
            while (e != null)
            {
                messages.Add(e);
                e = e.InnerException;
            }
            Console.WriteLine(" ");
            Console.WriteLine("------- System.Exception ----------------------------- ");
            messages.Reverse();

            foreach (System.Exception ex in messages)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(" ");
            Console.WriteLine("----- Details -----");
            foreach (System.Exception ex in messages)
            {
                Console.WriteLine("Message..........: " + ex.Message);
                Console.WriteLine("Stact trace......: " + ex.StackTrace);
                Console.WriteLine("TargetSite.......: " + ex.TargetSite.Name);
                Console.WriteLine("Source...........: " + ex.Source);
                Console.WriteLine(" ");
            }
        }
开发者ID:KangChaofan,项目名称:OOC,代码行数:28,代码来源:ExceptionHandler.cs


示例17: Player

		public Player(string name, System.DateTime birthDate, NeoDatis.Odb.Test.VO.Sport.Sport
			 favoriteSport)
		{
			this.name = name;
			this.birthDate = birthDate;
			this.favoriteSport = favoriteSport;
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:7,代码来源:Player.cs


示例18: ChangeLanguage

		/// <summary>
		///     Changes the language of the <c>Form</c> object provided and all
		///     its MDI children (in the case of MDI UI) to the currently
		///     selected language.
		/// </summary>
		/// <param name="form">
		///     <c>Form</c> object to apply changes to.
		/// </param>
		/// <param name="cultureInfo">
		///     <c>CultureInfo</c> to which language has to be changed.
		/// </param>
		public void ChangeLanguage(System.Windows.Forms.Form form, System.Globalization.CultureInfo cultureInfo) {
			m_cultureInfo = cultureInfo;
			ChangeFormLanguage(form);
			foreach (System.Windows.Forms.Form childForm in form.MdiChildren) {
				ChangeFormLanguage(childForm);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:18,代码来源:FormLanguageSwitch.cs


示例19: sbmt_Click

        protected void sbmt_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                int createMacroVal = 0;
                if (createMacro.Checked)
                    createMacroVal = 1;

                string xsltName = UmbracoSettings.UseLegacyXmlSchema ? xsltTemplate.SelectedValue :
                    Path.Combine("schema2", xsltTemplate.SelectedValue);

                string returnUrl = dialogHandler_temp.Create(
                    helper.Request("nodeType"),
                    createMacroVal,
                    xsltName + "|||" + rename.Text);

                BasePage.Current.ClientTools
                    .ChangeContentFrameUrl(returnUrl)
                    .ChildNodeCreated()
                    .CloseModalWindow();




            }

        }
开发者ID:Jeavon,项目名称:Umbraco-CMS,代码行数:27,代码来源:xslt.ascx.cs


示例20: ImportParameterAsset

    // Import Message Asset
    private static void ImportParameterAsset(string path, System.Type type)
    {
        try{
            if( File.Exists(path) == false ){
                return;
            }

            string s = File.ReadAllText(path);

            string asset_path = GetAssetPath(path);
            DataClassBase data = AssetDatabase.LoadAssetAtPath(asset_path, type) as DataClassBase;
            if( data == null ){
                data = ScriptableObject.CreateInstance(type) as DataClassBase;
                if( data == null ){
                    return;
                }
                data.Load(s, path);
                AssetDatabase.CreateAsset(data, asset_path);
            }
            else{
                data.Reload(s, path);
            }

            EditorUtility.SetDirty(data);
            AssetDatabase.SaveAssets();
        }
        catch(System.Exception err){
            Debug.Log(err.Message);
            EditorUtility.DisplayDialog("Import Error", "Error File : " + path, "OK");
        }
    }
开发者ID:Ginjack,项目名称:dir-kn,代码行数:32,代码来源:ParameterImporter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.Action类代码示例发布时间:2022-05-24
下一篇:
C# SysUserBLL类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap