本文整理汇总了C#中ICore类的典型用法代码示例。如果您正苦于以下问题:C# ICore类的具体用法?C# ICore怎么用?C# ICore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICore类属于命名空间,在下文中一共展示了ICore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
//---------------------------------------------------------------------
public static void Initialize(ICore modelCore)
{
landUse = modelCore.Landscape.NewSiteVar<LandUse>();
allowHarvest = new AllowHarvestSiteVar();
Model.Core.RegisterSiteVar(allowHarvest, "LandUse.AllowHarvest");
Landis.Library.BiomassHarvest.SiteVars.CohortsPartiallyDamaged = modelCore.Landscape.NewSiteVar<int>();
}
示例2: Action
public override void Action(ICore core)
{
if (core.TottalDurability <= 0)
{
core.TottalDurability += this.PressureAffection;
}
}
示例3: LoadParameters
//---------------------------------------------------------------------
public override void LoadParameters(string dataFile,
ICore mCore)
{
modelCore = mCore;
// Add local event handler for cohorts death due to age-only
// disturbances.
Cohort.AgeOnlyDeathEvent += CohortKilledByAgeOnlyDisturbance;
HarvestMgmtLib.Main.InitializeLib(modelCore);
HarvestExtensionMain.SiteHarvestedEvent += SiteHarvested;
Landis.Library.BiomassHarvest.Main.InitializeLib(modelCore);
ParametersParser parser = new ParametersParser(modelCore.Species);
HarvestMgmtLib.IInputParameters baseParameters = Landis.Data.Load<IInputParameters>(dataFile, parser);
parameters = baseParameters as IParameters;
if (parser.RoundedRepeatIntervals.Count > 0)
{
ModelCore.UI.WriteLine("NOTE: The following repeat intervals were rounded up to");
ModelCore.UI.WriteLine(" ensure they were multiples of the harvest timestep:");
ModelCore.UI.WriteLine(" File: {0}", dataFile);
foreach (RoundedInterval interval in parser.RoundedRepeatIntervals)
ModelCore.UI.WriteLine(" At line {0}, the interval {1} rounded up to {2}",
interval.LineNumber,
interval.Original,
interval.Adjusted);
}
}
示例4: Initialize
//---------------------------------------------------------------------
/// <summary>
/// Initializes the instance and its associated site variables.
/// </summary>
protected void Initialize(ICore modelCore,
SeedingAlgorithms seedAlg)//,
//Reproduction.Delegates.AddNewCohort addNewCohort)
{
Model.Core = modelCore;
SiteVars.Initialize();
Seeding.InitializeMaxSeedNeighborhood();
disturbedSites = new DisturbedSiteEnumerator(Model.Core.Landscape,
SiteVars.Disturbed);
SeedingAlgorithm algorithm;
switch (seedAlg)
{
case SeedingAlgorithms.NoDispersal:
algorithm = NoDispersal.Algorithm;
break;
case SeedingAlgorithms.UniversalDispersal:
algorithm = UniversalDispersal.Algorithm;
break;
case SeedingAlgorithms.WardSeedDispersal:
algorithm = WardSeedDispersal.Algorithm;
break;
default:
throw new ArgumentException(string.Format("Unknown seeding algorithm: {0}", seedAlg));
}
Reproduction.Initialize(algorithm);
}
示例5: LoadParameters
//---------------------------------------------------------------------
public override void LoadParameters(string dataFile, ICore mCore)
{
modelCore = mCore;
SiteVars.Initialize();
InputParameterParser parser = new InputParameterParser();
parameters = Landis.Data.Load<IInputParameters>(dataFile, parser);
}
示例6: UIView
public UIView(ICore core, UIType menuType, int width, int height, UIFlags flags, bool transparent)
: base(core)
{
webCore = core.GetService<IUIManagerService>().GetWebCore();
this.menuType = menuType;
this.width = width;
this.height = height;
this.flags = flags;
this.isTransparent = transparent;
isLoading = false;
pageLoaded = false;
webTextureID = TextureFactory.CreateTexture(width, height, isTransparent);
hudPosX = 0;
hudPosY = 0;
hud = new TVScreen2DImmediate();
Keyboard = core.GetService<IKeyboardService>();
Mouse = core.GetService<IMouseService>();
JoyStick = core.GetService<IJoyStickService>();
Gamepad = core.GetService<IGamepadsService>();
CanculateHudPosition(flags);
View = webCore.CreateWebView(width, height, isTransparent, true);
View.OnFinishLoading += OnFinishLoading;
View.OnCallback += OnCallback;
View.Focus();
buttonClickSound = Core.GetService<ISoundManagerService>().Load2DSound(Path.Combine(Application.StartupPath, @"Data\Sounds\menu\button_click.mp3"));
buttonFocusSound = Core.GetService<ISoundManagerService>().Load2DSound(Path.Combine(Application.StartupPath, @"Data\Sounds\menu\button_focus.mp3"));
Core.GetService<ISoundManagerService>().SetVolume(buttonClickSound, 0.5f);
Core.GetService<ISoundManagerService>().SetVolume(buttonFocusSound, 0.5f);
}
示例7: eMailSettingsForm
public eMailSettingsForm(ICore pipeProxy, GeneralOptions go)
{
InitializeComponent();
_pipeProxy = pipeProxy;
_go = go;
}
示例8: Initialize
//---------------------------------------------------------------------
public static void Initialize(ICore modelCore)
{
timeOfLastBDA = modelCore.Landscape.NewSiteVar<int>();
neighborResourceDom = modelCore.Landscape.NewSiteVar<double>();
siteResourceDomMod = modelCore.Landscape.NewSiteVar<double>();
siteResourceDom = modelCore.Landscape.NewSiteVar<double>();
vulnerability = modelCore.Landscape.NewSiteVar<double>();
disturbed = modelCore.Landscape.NewSiteVar<bool>();
numberCFSconifersKilled = modelCore.Landscape.NewSiteVar<Dictionary<int, int>>();
timeOfNext = modelCore.Landscape.NewSiteVar<int>();
agentName = modelCore.Landscape.NewSiteVar<string>();
biomassInsectsAgent = modelCore.Landscape.NewSiteVar<string>();
SiteVars.TimeOfLastEvent.ActiveSiteValues = -10000;
SiteVars.NeighborResourceDom.ActiveSiteValues = 0.0;
SiteVars.SiteResourceDomMod.ActiveSiteValues = 0.0;
SiteVars.SiteResourceDom.ActiveSiteValues = 0.0;
SiteVars.Vulnerability.ActiveSiteValues = 0.0;
SiteVars.TimeOfNext.ActiveSiteValues = 9999;
SiteVars.AgentName.ActiveSiteValues = "";
cohorts = PlugIn.ModelCore.GetSiteVar<ISiteCohorts>("Succession.AgeCohorts");
foreach(ActiveSite site in modelCore.Landscape)
SiteVars.NumberCFSconifersKilled[site] = new Dictionary<int, int>();
// Added for v1.1 to enable interactions with CFS fuels extension.
modelCore.RegisterSiteVar(SiteVars.NumberCFSconifersKilled, "BDA.NumCFSConifers");
modelCore.RegisterSiteVar(SiteVars.TimeOfLastEvent, "BDA.TimeOfLastEvent");
modelCore.RegisterSiteVar(SiteVars.AgentName, "BDA.AgentName");
// Added to enable interactions with other extensions (Presalvage harvest)
modelCore.RegisterSiteVar(SiteVars.TimeOfNext, "BDA.TimeOfNext");
}
示例9: LoadParameters
//---------------------------------------------------------------------
public override void LoadParameters(string dataFile,
ICore mCore)
{
modelCore = mCore;
InputParametersParser parser = new InputParametersParser();
parameters = modelCore.Load<IInputParameters>(dataFile, parser);
}
示例10: Initialize
//---------------------------------------------------------------------
public static void Initialize(ICore modelCore)
{
core = modelCore;
modelCore.Log.WriteLine("Inside Initialize method !!!");
ecoregions = modelCore.Landscape.NewSiteVar<IFireRegion>();
eventVar = modelCore.Landscape.NewSiteVar<Event>(InactiveSiteMode.DistinctValues);
timeOfLastFire = modelCore.Landscape.NewSiteVar<int>();
severity = modelCore.Landscape.NewSiteVar<byte>();
disturbed = modelCore.Landscape.NewSiteVar<bool>();
cohorts = modelCore.GetSiteVar<SiteCohorts>("Succession.Cohorts");
// Enable interactions with (almost) any fire extension:
modelCore.RegisterSiteVar(SiteVars.Severity, "Fire.Severity");
//Initialize TimeSinceLastFire to the maximum cohort age:
foreach (ActiveSite site in modelCore.Landscape)
{
// Test to make sure the cohort type is correct for this extension
if (site.Location.Row == 1 && site.Location.Column == 1 && !SiteVars.Cohorts[site].HasAge())
{
throw new System.ApplicationException("Error in the Scenario file: Incompatible extensions; Cohort age data required for this extension to operate.");
}
//UI.WriteLine("Inside foreach loop. Site R/C = {0}/{1} !!!", site.Location.Row, site.Location.Column);
ushort maxAge = Library.BaseCohorts.Util.GetMaxAge(cohorts[site]);
//ushort maxAge = Library.Cohort.AgeOnly.Util.GetMaxAge(SiteVars.Cohorts[site]);
//UI.WriteLine("Assigned maxAge");
timeOfLastFire[site] = modelCore.StartTime - maxAge;
}
}
示例11: Server
/// <summary>
/// Initializes a new instance of the <see cref="Server" /> class.
/// </summary>
/// <param name="core">
/// 進入點物件
/// </param>
/// <param name="port">
/// 監聽的埠
/// </param>
public Server(ICore core, int port)
{
_ThreadCoreHandler = new ThreadCoreHandler(core);
_ThreadSocketHandler = new ThreadSocketHandler(port, _ThreadCoreHandler);
_WaitSocket = new AutoResetEvent(false);
}
示例12: LoadParameters
//---------------------------------------------------------------------
public override void LoadParameters(string dataFile, ICore mCore)
{
modelCore = mCore;
Landis.Library.HarvestManagement.Main.InitializeLib(modelCore);
InputParametersParser parser = new InputParametersParser(mCore.Species);
parameters = Landis.Data.Load<IInputParameters>(dataFile, parser);
if (parser.RoundedRepeatIntervals.Count > 0)
{
PlugIn.ModelCore.UI.WriteLine("NOTE: The following repeat intervals were rounded up to");
PlugIn.ModelCore.UI.WriteLine(" ensure they were multiples of the harvest timestep:");
PlugIn.ModelCore.UI.WriteLine(" File: {0}", dataFile);
foreach (RoundedInterval interval in parser.RoundedRepeatIntervals)
PlugIn.ModelCore.UI.WriteLine(" At line {0}, the interval {1} rounded up to {2}",
interval.LineNumber,
interval.Original,
interval.Adjusted);
}
if (parser.ParserNotes.Count > 0)
{
foreach (List<string> nList in parser.ParserNotes)
{
foreach (string nLine in nList)
{
PlugIn.ModelCore.UI.WriteLine(nLine);
}
}
}
}
示例13: LoadParameters
//---------------------------------------------------------------------
public override void LoadParameters(string dataFile,
ICore mCore)
{
ExtensionMain baseHarvest = new BaseHarvest.PlugIn();
try
{
baseHarvest.LoadParameters(null, mCore);
}
catch (System.ArgumentNullException)
{
// ignore
}
modelCore = mCore;
// Add local event handler for cohorts death due to age-only
// disturbances.
Landis.Library.LeafBiomassCohorts.Cohort.AgeOnlyDeathEvent += CohortKilledByAgeOnlyDisturbance;
InputParametersParser parser = new InputParametersParser(modelCore.Species);
BaseHarvest.IInputParameters baseParameters = Landis.Data.Load<BaseHarvest.IInputParameters>(dataFile, parser);
parameters = baseParameters as IInputParameters;
if (parser.RoundedRepeatIntervals.Count > 0)
{
modelCore.UI.WriteLine("NOTE: The following repeat intervals were rounded up to");
modelCore.UI.WriteLine(" ensure they were multiples of the harvest timestep:");
modelCore.UI.WriteLine(" File: {0}", dataFile);
foreach (RoundedInterval interval in parser.RoundedRepeatIntervals)
modelCore.UI.WriteLine(" At line {0}, the interval {1} rounded up to {2}",
interval.LineNumber,
interval.Original,
interval.Adjusted);
}
}
示例14: Run
public static bool Run(Plugin plugin, ICore core)
{
var gcList = from Geocache gc in core.Geocaches
where gc.FoundDate!=null
&& ((DateTime)gc.FoundDate).Month == gc.PublishedTime.Month
&& ((DateTime)gc.FoundDate).Day == gc.PublishedTime.Day
select gc;
//mass update, so within begin and end
core.Geocaches.BeginUpdate();
//reset current selection
foreach (Geocache gc in core.Geocaches)
{
gc.Selected = false;
}
//set the intended selection
foreach (Geocache gc in gcList)
{
gc.Selected = true;
}
core.Geocaches.EndUpdate();
return true;
}
示例15: Run
public static bool Run(Plugin plugin, ICore core)
{
DateTime dt = DateTime.Now.AddDays(-7);
var gcList = from Geocache gc in core.Geocaches
where gc.DataFromDate < dt
select gc;
//mass update, so within begin and end
core.Geocaches.BeginUpdate();
//reset current selection
foreach (Geocache gc in core.Geocaches)
{
gc.Selected = false;
}
//set the intended selection
foreach (Geocache gc in gcList)
{
gc.Selected = true;
}
if (MessageBox.Show(LanguageSupport.Instance.GetTranslation("Automatically archive selected geocaches?"),LanguageSupport.Instance.GetTranslation("Archive"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)== DialogResult.Yes)
{
foreach (Geocache gc in gcList)
{
gc.Archived = true;
gc.Available = false;
}
}
core.Geocaches.EndUpdate();
return true;
}