本文整理汇总了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));
}
示例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;
}
示例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
}
示例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.
}
示例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 );
}
}
}
示例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());
}
}
示例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);
}
示例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;
}
示例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);
}
}
}
}
示例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
}
}
示例11: MainForm
public MainForm()
{
InitializeComponent();
InitializeFilters();
_history = new History<Bitmap>(10);
UpdateMenuHistoryItems();
}
示例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();
}
示例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;
}
}
示例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;
}
示例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);
}