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


C# History类代码示例

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


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

示例1: TestInvertedIntersect

        public void TestInvertedIntersect()
        {
            var a = History.AllTime ();
            a.Add (new DateTime (2010, 1, 1));
            a.Add (new DateTime (2010, 1, 10));

            var b = new History ();
            b.Add (new DateTime (2010, 1, 8));
            b.Add (new DateTime (2010, 1, 12));

            var c = History.Intersect (a, b);
            Assert.False (c.Inverted);
            Assert.True (c[0] == new DateTime (2010, 1, 10));
            Assert.True (c[1] == new DateTime (2010, 1, 12));

            var d = History.Intersect (b, a);
            Assert.False (d.Inverted);
            Assert.True (d[0] == new DateTime (2010, 1, 10));
            Assert.True (d[1] == new DateTime (2010, 1, 12));

            b.Inverted = true;
            var e = History.Intersect (a, b);
            Assert.True (e.Inverted);
            Assert.True (e[0] == new DateTime (2010, 1, 1));
            Assert.True (e[1] == new DateTime (2010, 1, 12));
        }
开发者ID:bvssvni,项目名称:csharp-play,代码行数:26,代码来源:TestHistory.cs

示例2: CalculateHistory

        private static List<History> CalculateHistory(double total, double rate, int month)
        {
            double payment = GradedCredit.CalculateMainMonthlyPayment(total, month);

            List<History> historyList = new List<History>();

            double residue = total;

            for (int i = 1; i <= month; i++)
            {
                double percent = residue * rate / 12;

                History history = new History()
                {
                    Month = i,
                    Percent = percent,
                    Debt = payment,
                    Residue = residue
                };

                historyList.Add(history);

                residue -= payment;

            }

            return historyList;
        }
开发者ID:pavelkasyanov,项目名称:LalkaBank,代码行数:28,代码来源:GradedCredit.cs

示例3: XnaConsoleComponent

        /// <summary>
        /// Initializes a new instance of the class, which creates a console for executing commands while running a game.
        /// </summary>
        /// <param name="game"></param>
        /// <param name="interp"></param>
        /// <param name="font"></param>
        public XnaConsoleComponent()
        {
            #if !XBOX
            device = Game.GraphicsDevice;
            spriteBatch = new SpriteBatch(device);
            this.font = XdtkResources.Font;
            background = new Texture2D(device, 1, 1, 1, TextureUsage.None,
                SurfaceFormat.Color);
            background.SetData<Color>(new Color[1] { new Color(0, 0, 0, 125) });

            InputBuffer = "";

            history = (History)XdtkResources.Config.Get("XnaConsole.History", new XnaConsoleComponent.History());
            XdtkResources.Config.Set("XnaConsole.History", history);
            WriteLine(XdtkConsole.Version);

            consoleXSize = Game.Window.ClientBounds.Right - Game.Window.ClientBounds.Left - 200;
            consoleYSize = font.LineSpacing * LinesDisplayed + 20;
            lineWidth = (int)(consoleXSize / font.MeasureString("a").X) - 2; //calculate number of letters that fit on a line, using "a" as example character

            State = ConsoleState.Closed;
            StateStartTime = 0;
            LastKeyState = this.CurrentKeyState = Keyboard.GetState();
            firstInterval = 500f;
            repeatInterval = 50f;

            //used for repeating keystrokes
            keyTimes = new Dictionary<Keys, double>();
            for (int i = 0; i < Enum.GetValues(typeof(Keys)).Length; i++)
            {
                Keys key = (Keys)Enum.GetValues(typeof(Keys)).GetValue(i);
                keyTimes[key] = 0f;
            }
            #endif
        }
开发者ID:bartwe,项目名称:Gearset,代码行数:41,代码来源:XnaConsole.cs

示例4: TestMaxLength

        public void TestMaxLength()
        {
            var buffer = _testHost.ExportProvider.GetExport<ITextBufferFactoryService>().Value.CreateTextBuffer();
            buffer.Insert(0, "0123456789");
            var snapshot = buffer.CurrentSnapshot;

            var history = new History(maxLength: 0);

            history.Add(new SnapshotSpan(snapshot, new Span(0, 1)));
            Assert.Empty(GetHistoryEntries(history));

            history = new History(maxLength: 1);
            history.Add(new SnapshotSpan(snapshot, new Span(0, 1)));
            Assert.Equal(new[] { "0" }, GetHistoryEntries(history));
            history.Add(new SnapshotSpan(snapshot, new Span(1, 1)));
            Assert.Equal(new[] { "1" }, GetHistoryEntries(history)); // Oldest entry is dropped.

            history = new History(maxLength: 2);
            history.Add(new SnapshotSpan(snapshot, new Span(0, 1)));
            Assert.Equal(new[] { "0" }, GetHistoryEntries(history));
            history.Add(new SnapshotSpan(snapshot, new Span(1, 1)));
            Assert.Equal(new[] { "0", "1" }, GetHistoryEntries(history));
            history.Add(new SnapshotSpan(snapshot, new Span(2, 1)));
            Assert.Equal(new[] { "1", "2" }, GetHistoryEntries(history)); // Oldest entry is dropped.
        }
开发者ID:noahfalk,项目名称:roslyn,代码行数:25,代码来源:HistoryTests.cs

示例5: SaveChanges

        /// <summary>
        /// Saves the changes.
        /// </summary>
        /// <param name="modelType">Type of the model.</param>
        /// <param name="categoryGuid">The category unique identifier.</param>
        /// <param name="entityId">The entity identifier.</param>
        /// <param name="changes">The changes.</param>
        /// <param name="relatedModelType">Type of the related model.</param>
        /// <param name="relatedModelId">The related model identifier.</param>
        /// <param name="CurrentPersonId">The current person identifier.</param>
        public void SaveChanges( Type modelType, Guid categoryGuid, int entityId, List<string> changes, string caption, Type relatedModelType, int? relatedEntityId, int? CurrentPersonId )
        {

            var entityType = EntityTypeCache.Read(modelType);
            var category = CategoryCache.Read(categoryGuid);

            int? relatedEntityTypeId = null;
            if (relatedModelType != null)
            {
                var relatedEntityType = EntityTypeCache.Read(relatedModelType);
                if (relatedModelType != null)
                {
                    relatedEntityTypeId = relatedEntityType.Id;
                }
            }

            if (entityType != null && category != null)
            {
                foreach ( string message in changes.Where( m => m != null && m != "" ) )
                {
                    var history = new History();
                    history.EntityTypeId = entityType.Id;
                    history.CategoryId = category.Id;
                    history.EntityId = entityId;
                    history.Caption = caption;
                    history.Summary = message;
                    history.RelatedEntityTypeId = relatedEntityTypeId;
                    history.RelatedEntityId = relatedEntityId;
                    history.CreatedByPersonId = CurrentPersonId;
                    history.CreationDateTime = DateTime.Now;
                    Add( history, CurrentPersonId );
                    Save( history, CurrentPersonId );
                }
            }
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:45,代码来源:HistoryService.Partial.cs

示例6: CreateEvent

    public void CreateEvent(History history)
    {
        try
        {
        history.EventDate = DateTime.Now.ToString("MM-dd-yy h:mm:ss tt");

        if(string.IsNullOrEmpty(history.IP))
            history.IP = (string)HttpContext.Current.Session["ip_address"];

        if(string.IsNullOrEmpty(history.EventUser))
            history.EventUser = HttpContext.Current.User.Identity.Name;

            using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
            {
                NpgsqlCommand cmd = new NpgsqlCommand("history_createevent", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new NpgsqlParameter("@eventDate", history.EventDate));
                cmd.Parameters.Add(new NpgsqlParameter("@type", history.Type));
                cmd.Parameters.Add(new NpgsqlParameter("@event", history.Event));
                cmd.Parameters.Add(new NpgsqlParameter("@ip", history.IP));
                cmd.Parameters.Add(new NpgsqlParameter("@user", history.EventUser));
                cmd.Parameters.Add(new NpgsqlParameter("@notes", history.Notes));
                cmd.Parameters.Add(new NpgsqlParameter("@typeid", history.TypeID));
                conn.Open();
                cmd.ExecuteNonQuery();
            }
        }
        catch (Exception ex)
        {
            Logger.Log(ex.ToString());
        }
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:32,代码来源:History.cs

示例7: XRayImage

        public XRayImage (ViewObject viewObject, StatusBarItems statusBarItems, History history, SysConfiguration SysConfig)
        {
            InitializeComponent();
            MainXRayView.Image.Visibility = System.Windows.Visibility.Hidden;

            m_MagnifierSettings.IsMagniferEnabled = false;
            m_MagnifierSettings.Radius = 0;
            m_MagnifierSettings.MagnFactor = 2.0;
            m_MagnifierSettings.AspectRatio = 0;
            m_MaxDetectorsPerBoard = viewObject.MaxDetectorsPerBoard;
            m_bitsPerPixel = viewObject.BitsPerPixel;
            m_ViewObject = viewObject;
            m_statusBarItems = statusBarItems;

            MainXRayView.Setup(viewObject, history, SysConfig);   
            

            MainXRayView.adonerImageObject.measureAdorner.SamplingSpace = viewObject.SamplingSpace;
            MainXRayView.adonerImageObject.measureAdorner.SamplingSpeed = viewObject.SamplingSpeed;

            MainXRayView.Cursor = Cursors.Hand;
            MainXRayView.Image.MouseMove += new MouseEventHandler(Img_MouseMove);
            MainXRayView.Image.MouseLeave += new MouseEventHandler(Img_MouseLeave);

            MainXRayView.MagnifierDockPanel.SizeChanged += new SizeChangedEventHandler(Magnifier_SizeChanged);
            MainXRayView.MagnifierDockPanel.MouseMove += new MouseEventHandler(Magnifier_MouseMove);
            MainXRayView.MagnifierDockPanel.MouseLeftButtonDown += new MouseButtonEventHandler(Magnifier_MouseMove);
            
        }
开发者ID:BdGL3,项目名称:CXPortal,代码行数:29,代码来源:XRayImage.xaml.cs

示例8: ConvertToHistories

        public static List<History> ConvertToHistories(this DataInterchange data)
        {
            var parsedHistories = new List<History>();

            if (data.resultType == ResultType.orders)
                return parsedHistories;

            var rowset = data.rowsets.First();

            foreach (var row in rowset.rows)
            {
                var history = new History();

                for (var i = 0; i < row.Count; i++)
                {
                    var prop = typeof(History).GetProperty(data.columns[i], BindingFlags.Public | BindingFlags.Instance);

                    if (null != prop && prop.CanWrite)
                    {
                        prop.SetValue(history, row[i], null);
                    }
                }

                history.typeID = rowset.typeID;
                history.regionID = rowset.regionID;
                history.generatedAt = rowset.generatedAt;

                parsedHistories.Add(history);
            }

            return parsedHistories;
        }
开发者ID:Kazetsukai,项目名称:EVEMarketWatch,代码行数:32,代码来源:DataInterchangeExtensions.cs

示例9: HistoryViewModel

        public HistoryViewModel(int? playerId)
            : this()
        {
            if (playerId != null)
            {
                using (IGameDataService dataService = new GameDataService())
                {
                    IEnumerable<DB.Match> playingMatches = dataService.GetAllMatchesForPlayer(playerId.Value);
                    foreach (var match in playingMatches)
                    {
                        DB.Player opponent = dataService.GetPlayer(match.PlayerOneId == playerId ? match.PlayerTwoId : match.PlayerOneId);
                        DB.Game currentGame = dataService.GetGame(match.CurrentGameId.Value);
                        DB.Player winningPlayer = null;
                        if (match.WinningPlayerId != null)
                            winningPlayer = dataService.GetPlayer(match.WinningPlayerId.Value);

                        HistoryViewModel.History history = new History();
                        history.MatchId = match.MatchId;
                        history.OpponentName = opponent.PlayerName;
                        history.Winner = winningPlayer != null ? winningPlayer.PlayerName : "none";
                        history.EndDate = match.EndDate;
                        history.StartDateTime = match.CreateDate;

                        this.Histories.Add(history);
                    }
                }
            }
        }
开发者ID:Codeketeers,项目名称:TicTacTotalDomination,代码行数:28,代码来源:HistoryViewModel.cs

示例10: DataHandler

        XDocument settings; //xml settings document

        #endregion Fields

        #region Constructors

        public DataHandler()
        {
            //instantiate lists
            history = new History();
            bookmarks = new Bookmarks();

            //set path to user.home
            path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\settings.xml";

            //Read xml from user home, if no document exist, skip
            try
            {
                reader = XmlTextReader.Create(@path);
                settings = XDocument.Load(reader);
                //create objects and lists from xml
                loadBookmarks();
                loadHistory();
                loadHomePage();
                reader.Close();
            }
            catch (FileNotFoundException)
            {
                //skip this step
            }
        }
开发者ID:geekscruff,项目名称:m3app2_final,代码行数:31,代码来源:DataHandler.cs

示例11: MainForm

 public MainForm()
 {
     InitializeComponent();
     InitializeFilters();
     _history = new History<Bitmap>(10);
     UpdateMenuHistoryItems();
 }
开发者ID:segrived,项目名称:ImageEditor,代码行数:7,代码来源:MainForm.cs

示例12: HistoryWindow

        public HistoryWindow()
        {
            InitializeComponent();

            historial = new Historiales();

            medic = new Medic();
            user = new User();
            history = new History();

            medics = medic.GetAll();
            users = user.GetAll();
            histories = history.GetAll();

            foreach (Usuarios user in users)
            {
                comboUsers.Items.Add(user.nombre + " " + user.apellidos);
            }

            foreach (Medicos medic in medics)
            {
                comboMedics.Items.Add(medic.nombre + " " + medic.apellidos);
            }

            historialGrid.ItemsSource = histories.ToArray();
        }
开发者ID:Maldercito,项目名称:adat,代码行数:26,代码来源:1453974230$HistoryWindow.xaml.cs

示例13: XnaConsoleComponent

        /// <summary>
        /// Initializes a new instance of the class, which creates a console for executing commands while running a game.
        /// </summary>
        /// <param name="game"></param>
        /// <param name="interp"></param>
        /// <param name="font"></param>
        public XnaConsoleComponent(Game game, SpriteFont font)
            : base(game)
        {
            this.game = game;
            device = game.GraphicsDevice;
            spriteBatch = new SpriteBatch(device);
            this.font = font;
            background = new Texture2D(device, 1, 1);
            background.SetData<Color>(new Color[1] { new Color(0, 0, 0, 125) });

            InputBuffer = "";
            history = new History();

            WriteLine("###");
            WriteLine("### " + Version);
            WriteLine("###");

            consoleXSize = Game.Window.ClientBounds.Right - Game.Window.ClientBounds.Left - 20;
            consoleYSize = font.LineSpacing * LinesDisplayed + 20;
            lineWidth = (int)(consoleXSize / font.MeasureString("a").X) - 2; //calculate number of letters that fit on a line, using "a" as example character

            State = ConsoleState.Closed;
            StateStartTime = 0;
            LastKeyState = this.CurrentKeyState = Keyboard.GetState();
            firstInterval = 500f;
            repeatInterval = 50f;

            //used for repeating keystrokes
            keyTimes = new Dictionary<Keys, double>();
            for (int i = 0; i < Enum.GetValues(typeof(Keys)).Length; i++)
            {
                Keys key = (Keys)Enum.GetValues(typeof(Keys)).GetValue(i);
                keyTimes[key] = 0f;
            }
        }
开发者ID:asarudick,项目名称:Soapvox,代码行数:41,代码来源:XnaConsole.cs

示例14: GetHistories

        public List<History> GetHistories(Roll roll)
        {
            string sql = HistorySql(roll);
            var reader = Data_Context.RunSelectSQLQuery(sql, 30);

            var histories = new List<History>();

            if (reader.HasRows)
            {
                var sReader = new SpecialistsReader();
                while (reader.Read())
                {
                    string uName = reader["UserName"] as string;
                    var spec = sReader.GetSpecialist(uName);
                    string m = reader["Message"] as string;
                    DateTime date = reader.GetDateTime(3);
                    string step = reader["CurrentQueue"] as string;

                    var note = new History(spec, m, date, step);
                    histories.Add(note);
                }
                Data_Context.CloseConnection();
                return histories;
            }
            else return null;
        }
开发者ID:reedcwilson,项目名称:SpecialistDashboard,代码行数:26,代码来源:HistoryReader.cs

示例15: MainWindow_Load

		void MainWindow_Load(object sender, EventArgs e)
		{
			var indexManager = Program.IndexUpdateManager;
			indexManager.UpdaterChange += IndexUpdaterCallback;
			indexManager.CheckIndexIsFresh ().ContinueWith (t => {
				if (t.IsFaulted)
					Logger.LogError ("Error while checking indexes", t.Exception);
				else if (!t.Result)
					indexManager.PerformSearchIndexCreation ();
				else
					indexManager.AdvertiseFreshIndex ();
			}).ContinueWith (t => Logger.LogError ("Error while creating indexes", t.Exception), TaskContinuationOptions.OnlyOnFaulted);

			SetupSearch ();
			SetupDocTree ();
			SetupBookmarks ();
			history = new History (backButton, forwardButton);
			docBrowser.DocumentTitleChanged += (s, _) => currentTitle = docBrowser.DocumentTitle;
			docBrowser.DocumentCompleted += (s, _) => loadedFromString = false;
			docBrowser.Navigating += (s, nav) => {
				if (loadedFromString)
					return;
				string url = nav.Url.OriginalString;
				if (nav.Url.IsFile) {
					var segs = nav.Url.Segments;
					url = segs.LastOrDefault () == "*" ? segs.Skip (segs.Length - 2).Aggregate (string.Concat) : segs.LastOrDefault ();
				}

				LoadUrl (url, true);
				nav.Cancel = true;
			};
			LoadUrl (string.IsNullOrEmpty (initialUrl) ? "root:" : initialUrl, syncTreeView: true);
		}
开发者ID:col42dev,项目名称:mono-tools,代码行数:33,代码来源:MainWindow.cs


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