本文整理汇总了C#中System.Collections.Generic.List.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.Clear方法的具体用法?C# System.Collections.Generic.List.Clear怎么用?C# System.Collections.Generic.List.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUmzugsmitteilung
// Pre: No value is NULL
// Post: output report bytes
public static byte[] GetUmzugsmitteilung(COR_Reports.ReportFormatInfo formatInfo, string in_ump_uid, string in_sprache)
{
string report = "UM_Umzugsmitteilung2.rdl";
byte[] baReport = null;
// if (string.IsNullOrEmpty(in_ump_uid)) in_ump_uid = "C38CB749-1EEC-4686-9BBA-F627B9C4E8EC";
if (string.IsNullOrEmpty(in_sprache)) in_sprache = "DE";
// formatInfo = new Portal_Reports.ReportFormatInfo(ExportFormat.Word);
try
{
COR_Reports.ReportTools.ReportDataCallback_t myFunc = delegate(COR_Reports.ReportViewer viewer, System.Xml.XmlDocument doc)
{
// viewer["format"] = formatInfo.FormatName;
// viewer["extension"] = formatInfo.Extension;
// viewer["report"] = report;
//string extension = viewer["extension"];
////////////////////////////
System.Collections.Generic.List<COR_Reports.ReportParameter> lsParameters =
new System.Collections.Generic.List<COR_Reports.ReportParameter>();
viewer.SetParameters(lsParameters);
lsParameters.Clear();
lsParameters = null;
{
// Add data sources
COR_Reports.ReportDataSource rds = new COR_Reports.ReportDataSource();
rds.Name = "DataSet1"; //This refers to the dataset name in the RDLC file
string strSQL = COR_Reports.ReportTools.GetDataSetDefinition(doc, rds.Name);
rds.Value = SQL.GetDataTable(strSQL);
strSQL = null;
viewer.DataSources.Add(rds);
}
};
baReport = COR_Reports.ReportTools.RenderReport(report, formatInfo, myFunc);
}
catch
{
// Basic_SQL.SQL.Log(ex);
throw;
}
// If testing
if (System.StringComparer.InvariantCultureIgnoreCase.Equals(System.Environment.UserDomainName, "COR"))
{
using (System.IO.FileStream fs = System.IO.File.Create(@"D:\" + System.IO.Path.GetFileNameWithoutExtension(report) + formatInfo.Extension))
{
fs.Write(baReport, 0, baReport.Length);
} // End Using fs
}
return baReport;
}
示例2: ProcessRequest
//TODO simple JSON writer
//struct Info
//{
// public string Provider { get; set; }
//}
public override void ProcessRequest(WebRequest request)
{
//We don't need a list here, but I rather get away from the lock quicker.
var dependencies = new System.Collections.Generic.List<ResourceDependancy>();
WebServer.ForEachPage((page) =>
{
var dpd = page.GetDependencies();
if (dpd != null)
{
dependencies.AddRange(dpd);
}
});
//Since we are using a list we can make it a bit easier
request.Writer.Buffer(dependencies.Count);
foreach (var item in dependencies)
{
request.Writer.Buffer((byte)item.Type);
request.Writer.Buffer(item.Url);
}
dependencies.Clear();
dependencies = null;
request.WriteOut("application/octet-stream");
}
示例3: LoadScene
//public GameObject loadingImage;
public void LoadScene(string level)
{
Data.noMissions = false;
System.Collections.Generic.List<Mission> tempList = new System.Collections.Generic.List<Mission>();
for (int i = 0; i < Data.diplomacyList.Count; i++)
{
if (Data.diplomacyList[i].difficulty == Data.currentDifficulty && !Data.diplomacyList[i].isDone)
{
tempList.Add(Data.diplomacyList[i]);
}
}
System.Random r = new System.Random();
int randomIndex = r.Next(0, tempList.Count);
if (tempList.Count == 0)
{
//hotdogs
}
else if (!Data.preserveDipMission || !Data.lastDipMission.isListed)
{
Debug.Log("Random mission: " + randomIndex + " out of: " + tempList.Count);
Data.pickedMission = tempList[randomIndex];
Data.lastDipMission = Data.pickedMission;
Data.lastDipMission.isListed = true;
}
else
{
Data.pickedMission = Data.lastDipMission;
}
tempList.Clear();
Data.hitBack = false;
//loadingImage.SetActive(true);
Application.LoadLevel(level);
}
示例4: GetFooter
// D:\reportviewerz\2005
// Depends on TFS://COR-Library\COR_Reports\COR_Reports.csproj
// Pre: No value is NULL
// Post: output report bytes
public static byte[] GetFooter(string report, COR_Reports.ReportFormatInfo formatInfo, string in_aperturedwg, string in_stylizer)
{
byte[] baReport = null;
try
{
COR_Reports.ReportTools.ReportDataCallback_t myFunc = delegate(COR_Reports.ReportViewer viewer, System.Xml.XmlDocument doc)
{
// viewer["format"] = formatInfo.FormatName;
// viewer["extension"] = formatInfo.Extension;
// viewer["report"] = report;
//string extension = viewer["extension"];
////////////////////////////
System.Collections.Generic.List<COR_Reports.ReportParameter> lsParameters =
new System.Collections.Generic.List<COR_Reports.ReportParameter>();
lsParameters.Add(new COR_Reports.ReportParameter("in_aperturedwg", in_aperturedwg));
lsParameters.Add(new COR_Reports.ReportParameter("in_stylizer", in_stylizer));
// lsParameters.Add(new COR_Reports.ReportParameter("datastart", "dateTimePickerStartRaport.Text"));
// lsParameters.Add(new COR_Reports.ReportParameter("dataStop", "dateTimePickerStopRaport.Text"));
viewer.SetParameters(lsParameters);
lsParameters.Clear();
lsParameters = null;
// Add data sources
COR_Reports.ReportDataSource rds = new COR_Reports.ReportDataSource();
rds.Name = "DATA_Planinfo"; //This refers to the dataset name in the RDLC file
string strSQL = COR_Reports.ReportTools.GetDataSetDefinition(doc, rds.Name);
strSQL = strSQL.Replace("@in_aperturedwg", "'" + in_aperturedwg.Replace("'", "''") + "'");
strSQL = strSQL.Replace("@in_stylizer", "'" + in_stylizer.Replace("'", "''") + "'");
rds.Value = Basic_SQL.SQL.GetDataTable(strSQL);
strSQL = null;
viewer.DataSources.Add(rds);
}; // End Sub ReportDataCallback_t
baReport = COR_Reports.ReportTools.RenderReport(report, formatInfo, myFunc);
}
catch (System.Exception ex)
{
Basic_SQL.SQL.Log(ex);
throw;
}
// If testing
if (System.StringComparer.InvariantCultureIgnoreCase.Equals(System.Environment.UserDomainName, "COR"))
{
using (System.IO.FileStream fs = System.IO.File.Create(@"D:\" + System.IO.Path.GetFileNameWithoutExtension(report) + formatInfo.Extension))
{
fs.Write(baReport, 0, baReport.Length);
} // End Using fs
}
return baReport;
}
示例5: TestUseCase
public static void TestUseCase()
{
var a = new string[] { "a", "b", "c" };
var list = new System.Collections.Generic.List<string>(a);
list.AddRange(a);
Assert.AreEqual(a.Length, 3, "Bridge503: array.Length is correct");
Assert.AreEqual(list.Count, 6, "Bridge503: list.Count is correct");
list.Clear();
Assert.AreEqual(a.Length, 3, "Bridge503: array.Length is correct");
Assert.AreEqual(list.Count, 0, "Bridge503: list.Count is correct");
}
示例6: GetRunwayListFromConfig
public static System.Collections.Generic.List<Runway> GetRunwayListFromConfig(string sSettingURL)
{
System.Collections.Generic.List<Runway> runwayList = new System.Collections.Generic.List<Runway>();
runwayList.Clear();
ConfigNode runways = ConfigNode.Load(KSPUtil.ApplicationRootPath + sSettingURL);
foreach (ConfigNode node in runways.GetNodes("Runway"))
{
if (GlobalVariables.Settings.enableDebugging) Debug.Log("NavUtil: Found Runway Node");
try
{
Runway rwy = new Runway();
rwy.ident = node.GetValue("ident");
if (GlobalVariables.Settings.enableDebugging) Debug.Log("NavUtil: Loading " + rwy.ident);
rwy.shortID = node.GetValue("shortID");
if (rwy.shortID.Length > 4)
rwy.shortID.Remove(4);
rwy.hdg = float.Parse(node.GetValue("hdg"));
rwy.body = node.GetValue("body");
rwy.altMSL = float.Parse(node.GetValue("altMSL"));
rwy.gsLatitude = float.Parse(node.GetValue("gsLatitude"));
rwy.gsLongitude = float.Parse(node.GetValue("gsLongitude"));
rwy.locLatitude = float.Parse(node.GetValue("locLatitude"));
rwy.locLongitude = float.Parse(node.GetValue("locLongitude"));
rwy.outerMarkerDist = float.Parse(node.GetValue("outerMarkerDist"));
rwy.middleMarkerDist = float.Parse(node.GetValue("middleMarkerDist"));
rwy.innerMarkerDist = float.Parse(node.GetValue("innerMarkerDist"));
runwayList.Add(rwy);
if (GlobalVariables.Settings.enableDebugging) Debug.Log("NavUtil: Found " + rwy.ident);
}
catch (Exception)
{
if (GlobalVariables.Settings.enableDebugging) Debug.Log("NavUtil: Error loading runway");
throw;
}
}
return runwayList;
}
示例7: GetGlideslopeListFromConfig
public static System.Collections.Generic.List<float> GetGlideslopeListFromConfig(string sSettingURL)
{
System.Collections.Generic.List<float> gsList = new System.Collections.Generic.List<float>();
gsList.Clear();
ConfigNode gs = ConfigNode.Load(KSPUtil.ApplicationRootPath + sSettingURL);
foreach (ConfigNode node in gs.GetNodes("Glideslope"))
{
float f = new float();
f = float.Parse(node.GetValue("glideslope"));
gsList.Add(f);
}
return gsList;
}
示例8: LoadScene
//public GameObject loadingImage;
public void LoadScene(string level)
{
System.Collections.Generic.List<Mission> tempList = new System.Collections.Generic.List<Mission>();
for(int i=0; i<Data.militaryList.Count; i++)
{
if (Data.militaryList[i].difficulty == Data.currentDifficulty)
{
tempList.Add(Data.militaryList[i]);
}
}
System.Random r = new System.Random();
int randomIndex = r.Next(0, tempList.Count);
Debug.Log("Random mission: " + randomIndex + " out of: " +tempList.Count);
Data.pickedMission = tempList[randomIndex];
tempList.Clear();
//loadingImage.SetActive(true);
Application.LoadLevel(level);
}
示例9: FindCommand
/************************************************************************/
/* return null : 命令不存在; Count==0,用户没有选择
/************************************************************************/
public System.Collections.Generic.List<ConfigData> FindCommand(string shortcut)
{
GlobalVar.Helper.AddSelect("programs", "id,shortcut,path,title,is_auto_run,hints","shortcut");
GlobalVar.Helper.AddCustomParam("shortcut", shortcut);
DataTable table = new DataTable("programs");
System.Collections.Generic.List<ConfigData> list = new System.Collections.Generic.List<ConfigData>();
GlobalVar.Helper.Fill(ref table);
if (table.Rows.Count == 0)
return null;
foreach (DataRow row in table.Rows)
{
ConfigData cd = new ConfigData();
cd.Row = row;
GlobalVar.Helper.Row2DbObj(row, cd);
list.Add(cd);
}
if(list.Count > 1)
{
SelectFrm frm = new SelectFrm(list);
if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
frm.UpdateSelectedHint();
}
else
{
list.Clear();
return list;
}
//进行选择
}
else
{
DataRow row = list[0].Row;
int hint = row.Field<int>("hints");
row.SetField<int>("hints", ++hint);
}
Helper.AddUpdate("programs", "hints", "id");
Helper.Update(table);
return list;
}
示例10: ListRNDTest
public void ListRNDTest()
{
var controlList = new System.Collections.Generic.List<int>();
var testList = new MyList<int>();
var r = new System.Random();
for (int i = 0; i < 1000; i++)
{
var next = r.Next();
controlList.Add(next);
testList.Add(next);
Assert.AreEqual(controlList.Count, testList.Count);
}
for (int i = 0; i < 1000; i++)
{
Assert.IsTrue(testList.IndexOf(controlList[i]) == i);
}
for (int i = 0; i < controlList.Count; i++)
{
if (r.Next() < int.MaxValue / 2)
{
testList.RemoveAt(i);
controlList.RemoveAt(i);
}
else
{
var newItem = r.Next();
testList.Insert(i, newItem);
controlList.Insert(i, newItem);
}
}
Assert.AreEqual(controlList.Count, testList.Count);
foreach (var itm in controlList){
Assert.IsTrue(testList.Contains(itm));
}
for (int i = 0; i < controlList.Count / 2; i++ )
{
var e = controlList[i];
controlList.Remove(e);
testList.Remove(e);
}
int[] controllarray = new int[controlList.Count+1];
int[] testArray = new int[testList.Count+1];
controllarray[0] = r.Next();
testArray[0] = controllarray[0];
controlList.CopyTo(controllarray, 1);
testList.CopyTo(testArray, 1);
var q = from a in testArray
join b in controllarray on a equals b
select a;
Assert.IsTrue(testArray.Length == controllarray.Length && q.Count() == controllarray.Length);
controlList.Clear();
testList.Clear();
Assert.AreEqual(controlList.Count,testList.Count);
}
示例11: GetPoints
public static PointF[] GetPoints(params UPointD[] upoints)
{
System.Collections.Generic.List<PointF> list = new System.Collections.Generic.List<PointF>();
foreach (UPointD d in upoints)
{
list.Add(d.FPoint);
}
PointF[] array = list.ToArray();
list.Clear();
return array;
}
示例12: GetUmzugsmitteilung
// Pre: No value is NULL
// Post: output report bytes
public static byte[] GetUmzugsmitteilung(COR_Reports.ReportFormatInfo formatInfo, string in_ump_uid, string in_sprache)
{
string report = "UM_Umzugsmitteilung.rdl";
byte[] baReport = null;
// if (string.IsNullOrEmpty(in_ump_uid)) in_ump_uid = "C38CB749-1EEC-4686-9BBA-F627B9C4E8EC";
if (string.IsNullOrEmpty(in_sprache)) in_sprache = "DE";
// formatInfo = new Portal_Reports.ReportFormatInfo(ExportFormat.Word);
try
{
COR_Reports.ReportTools.ReportDataCallback_t myFunc = delegate(COR_Reports.ReportViewer viewer, System.Xml.XmlDocument doc)
{
// viewer["format"] = formatInfo.FormatName;
// viewer["extension"] = formatInfo.Extension;
// viewer["report"] = report;
//string extension = viewer["extension"];
////////////////////////////
System.Collections.Generic.List<COR_Reports.ReportParameter> lsParameters =
new System.Collections.Generic.List<COR_Reports.ReportParameter>();
lsParameters.Add(new COR_Reports.ReportParameter("in_mandant", "0"));
lsParameters.Add(new COR_Reports.ReportParameter("proc", "administrator"));
lsParameters.Add(new COR_Reports.ReportParameter("in_sprache", in_sprache));
// lsParameters.Add(new Portal_Reports.ReportParameter("in_report_name", "UM_Umzugsmitteilung"));
// lsParameters.Add(new Portal_Reports.ReportParameter("in_stichtag", System.DateTime.Now.ToString("dd.MM.yyyy")));
// lsParameters.Add(new Portal_Reports.ReportParameter("def_pageformat", "Seite {0} von {1}"));
// lsParameters.Add(new Portal_Reports.ReportParameter("def_dateformat", "d.MM.yyyy"));
lsParameters.Add(new COR_Reports.ReportParameter("in_umzugsuid", in_ump_uid));
// lsParameters.Add(new COR_Reports.ReportParameter("datastart", "dateTimePickerStartRaport.Text"));
// lsParameters.Add(new COR_Reports.ReportParameter("dataStop", "dateTimePickerStopRaport.Text"));
viewer.SetParameters(lsParameters);
lsParameters.Clear();
lsParameters = null;
{
// Add data sources
COR_Reports.ReportDataSource rds = new COR_Reports.ReportDataSource();
rds.Name = "DATA_Umzugsmitteilung"; //This refers to the dataset name in the RDLC file
string strSQL = COR_Reports.ReportTools.GetDataSetDefinition(doc, rds.Name);
strSQL = strSQL.Replace("@_in_umzugsuid", "'" + in_ump_uid.Replace("'", "''") + "'");
strSQL = strSQL.Replace("@_in_sprache", "'" + in_sprache.Replace("'", "''") + "'");
rds.Value = SQL.GetDataTable(strSQL);
strSQL = null;
viewer.DataSources.Add(rds);
}
{
COR_Reports.ReportDataSource rdsHeader = new COR_Reports.ReportDataSource();
rdsHeader.Name = "DATA_Umzugsheader"; //This refers to the dataset name in the RDLC file
string strSQL = COR_Reports.ReportTools.GetDataSetDefinition(doc, rdsHeader.Name);
strSQL = strSQL.Replace("@_in_umzugsuid", "'" + in_ump_uid.Replace("'", "''") + "'");
rdsHeader.Value = SQL.GetDataTable(strSQL);
strSQL = null;
viewer.DataSources.Add(rdsHeader);
}
{
COR_Reports.ReportDataSource rdsTranslation = new COR_Reports.ReportDataSource();
rdsTranslation.Name = "DATA_Report_Translation"; //This refers to the dataset name in the RDLC file
string strSQL = COR_Reports.ReportTools.GetDataSetDefinition(doc, rdsTranslation.Name);
strSQL = strSQL.Replace("@in_sprache", "'" + in_sprache.Replace("'", "''") + "'");
rdsTranslation.Value = SQL.GetDataTable(strSQL);
strSQL = null;
viewer.DataSources.Add(rdsTranslation);
}
};
baReport = COR_Reports.ReportTools.RenderReport(report, formatInfo, myFunc);
}
catch
{
// Basic_SQL.SQL.Log(ex);
throw;
}
// If testing
if (System.StringComparer.InvariantCultureIgnoreCase.Equals(System.Environment.UserDomainName, "COR"))
{
using (System.IO.FileStream fs = System.IO.File.Create(@"D:\" + System.IO.Path.GetFileNameWithoutExtension(report) + formatInfo.Extension))
{
fs.Write(baReport, 0, baReport.Length);
} // End Using fs
}
return baReport;
}
示例13: TestIntervalTree_1
//.........这里部分代码省略.........
counter++;
}
NUnit.Framework.Assert.IsTrue(counter == 3);
iterator.ResetIterator(new com.esri.core.geometry.Envelope1D(10, 11), 0.0);
counter = 0;
while (iterator.Next() != -1)
{
counter++;
}
NUnit.Framework.Assert.IsTrue(counter == 3);
iterator.ResetIterator(new com.esri.core.geometry.Envelope1D(10, 10.9), 0.0);
counter = 0;
while (iterator.Next() != -1)
{
counter++;
}
NUnit.Framework.Assert.IsTrue(counter == 2);
iterator.ResetIterator(new com.esri.core.geometry.Envelope1D(11.5, 12), 0.0);
counter = 0;
while (iterator.Next() != -1)
{
counter++;
}
NUnit.Framework.Assert.IsTrue(counter == 2);
env0 = new com.esri.core.geometry.Envelope1D(0, 4);
env1 = new com.esri.core.geometry.Envelope1D(6, 7);
env2 = new com.esri.core.geometry.Envelope1D(9, 10);
env3 = new com.esri.core.geometry.Envelope1D(9, 11);
env4 = new com.esri.core.geometry.Envelope1D(7, 12);
env5 = new com.esri.core.geometry.Envelope1D(13, 15);
env6 = new com.esri.core.geometry.Envelope1D(1, 6);
env7 = new com.esri.core.geometry.Envelope1D(3, 3);
env8 = new com.esri.core.geometry.Envelope1D(8, 8);
intervals.Clear();
intervals.Add(env0);
intervals.Add(env1);
intervals.Add(env2);
intervals.Add(env3);
intervals.Add(env4);
intervals.Add(env5);
intervals.Add(env6);
intervals.Add(env7);
intervals.Add(env8);
com.esri.core.geometry.IntervalTreeImpl intervalTree2 = new com.esri.core.geometry.IntervalTreeImpl(true);
Construct(intervalTree2, intervals);
intervalTree2.Insert(0);
intervalTree2.Insert(1);
intervalTree2.Insert(2);
intervalTree2.Insert(3);
intervalTree2.Insert(4);
intervalTree2.Insert(5);
intervalTree2.Insert(6);
intervalTree2.Insert(7);
intervalTree2.Insert(8);
iterator = intervalTree2.GetIterator(new com.esri.core.geometry.Envelope1D(8, 8), 0.0);
counter = 0;
while (iterator.Next() != -1)
{
counter++;
}
NUnit.Framework.Assert.IsTrue(counter == 2);
iterator.ResetIterator(new com.esri.core.geometry.Envelope1D(3, 7), 0.0);
counter = 0;
while (iterator.Next() != -1)
{
counter++;
示例14: Update_PlotTrack_Data
private void Update_PlotTrack_Data()
{
if (this.checkEnableDisplay.Checked == true)
{
// First clear all the data from the previous cycle.
if (DinamicOverlay.Markers.Count > 0)
DinamicOverlay.Markers.Clear();
if (PredictionOverlay.Markers.Count > 0)
PredictionOverlay.Markers.Clear();
// Now get the data since the last cycle and display it on the map
DynamicDisplayBuilder DP = new DynamicDisplayBuilder();
System.Collections.Generic.List<DynamicDisplayBuilder.TargetType> TargetList = new System.Collections.Generic.List<DynamicDisplayBuilder.TargetType>();
// Here handle display od live data
if (SharedData.bool_Listen_for_Data == true)
{
DynamicDisplayBuilder.GetDisplayData(false, out TargetList);
if (FirstCycleDisplayEnabled)
{
FirstCycleDisplayEnabled = false;
TargetList.Clear();
}
this.lblNumberofTargets.Text = TargetList.Count.ToString();
bool Build_Local_Display = comboBoxLiveDisplayMode.Text != "Google Earth";
bool Provide_To_Google_Earth = comboBoxLiveDisplayMode.Text != "Local";
bool ProvideWebData = comboBoxLiveDisplayMode.Text == "Local & Web" || comboBoxLiveDisplayMode.Text == "Web";
Asterix_To_KML_Provider ASTX_TO_KML = new Asterix_To_KML_Provider();
WBTD WebBasedDisplayProvider = new WBTD();
PredictionBuilder Prediction_B = new PredictionBuilder();
try
{
foreach (DynamicDisplayBuilder.TargetType Target in TargetList)
{
if (Passes_Check_For_Flight_Level_Filter(Target.ModeC))
{
// If SSR code filtering is to be applied
if (this.checkBoxFilterBySSR.Checked == true && (this.textBoxSSRCode.Text.Length == 4))
{
if (Target.ModeA == this.textBoxSSRCode.Text)
{
Target.MyMarker.ToolTipMode = MarkerTooltipMode.Never;
Target.MyMarker.Position = new PointLatLng(Target.Lat, Target.Lon);
BuildDynamicLabelText(Target, ref Target.MyMarker);
SetLabelAttributes(ref Target.MyMarker);
if (Build_Local_Display)
{
DinamicOverlay.Markers.Add(Target.MyMarker);
if (SharedData.Prediction1_Enabled)
Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.One, ref PredictionOverlay);
if (SharedData.Prediction2_Enabled)
Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.Two, ref PredictionOverlay);
if (SharedData.Prediction3_Enabled)
Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.Three, ref PredictionOverlay);
}
if (Provide_To_Google_Earth)
ASTX_TO_KML.AddNewTarget(Target);
if (ProvideWebData)
WebBasedDisplayProvider.SetTargetData(Target.Lat.ToString(), Target.Lon.ToString(), Target.ACID_Mode_S,
Target.ModeA, Target.ModeC);
}
}
else // No SSR filter so just display all of them
{
Target.MyMarker.ToolTipMode = MarkerTooltipMode.Never;
Target.MyMarker.Position = new PointLatLng(Target.Lat, Target.Lon);
BuildDynamicLabelText(Target, ref Target.MyMarker);
SetLabelAttributes(ref Target.MyMarker);
if (Build_Local_Display)
{
DinamicOverlay.Markers.Add(Target.MyMarker);
if (SharedData.Prediction1_Enabled)
Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.One, ref PredictionOverlay);
if (SharedData.Prediction2_Enabled)
Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.Two, ref PredictionOverlay);
if (SharedData.Prediction3_Enabled)
Prediction_B.Build_Prediction_Marker(Target.MyMarker.Position, Target.MyMarker.CALLSIGN_STRING, MySqlProvider.PredictionTableNumberType.Three, ref PredictionOverlay);
}
if (Provide_To_Google_Earth)
ASTX_TO_KML.AddNewTarget(Target);
if (ProvideWebData)
//.........这里部分代码省略.........
示例15: ux_buttonEditData_Click
private void ux_buttonEditData_Click(object sender, EventArgs e)
{
// Remember the first visible column to restore later...
int firstVisibleColumn = ux_datagridviewMain.FirstDisplayedScrollingColumnIndex;
int currentRow = 0;
if (ux_datagridviewMain.CurrentRow != null) currentRow = ux_datagridviewMain.CurrentRow.Index;
//string currentColName = ux_datagridviewMain.Columns[ux_datagridviewMain.FirstDisplayedScrollingColumnIndex].Name;
// Remember all user settings...
SetAllUserSettings();
// Update the controls on the interface...
ux_groupboxEditMode.Visible = true;
ux_checkboxHighlightChanges.Enabled = true;
ux_checkboxHideNonErrorRows.Enabled = true;
ux_checkboxHideUnchangedRows.Enabled = true;
ux_buttonSaveData.Enabled = true;
ux_buttonEditData.Enabled = false;
ux_buttonCancelEditData.Enabled = true;
ux_splitcontainerMain.Panel1.Enabled = false;
ux_tabcontrolCTDataviews.Enabled = false;
// Bail if there is no data to process...
if (ux_tabcontrolCTDataviews.SelectedTab == null ||
ux_tabcontrolCTDataviews.SelectedTab.Tag == null ||
ux_tabcontrolCTDataviews.SelectedTab.Tag.GetType() != typeof(DataviewProperties) ||
string.IsNullOrEmpty(((DataviewProperties)ux_tabcontrolCTDataviews.SelectedTab.Tag).DataviewName))
{
return;
}
// Create a filtered and sorted copy of the data to be edited...
// First get the filtered and sorted rows in the readonly datatable copied to a new temp table...
DataTable filteredSortedTable = ((DataTable)((BindingSource)ux_datagridviewMain.DataSource).DataSource).DefaultView.ToTable();
// Create a new empty table that will have just the rows in the filtered and sorted rows in the temp table...
DataTable editTable = grinData.Tables[((DataviewProperties)ux_tabcontrolCTDataviews.SelectedTab.Tag).DataviewName].Clone();
// Add each row in the readonly view to the edit table...
System.Collections.Generic.List<object> pKeyVals = new System.Collections.Generic.List<object>();
foreach (DataRow dr in filteredSortedTable.Rows)
{
pKeyVals.Clear();
foreach (DataColumn pKeyCol in editTable.PrimaryKey)
{
pKeyVals.Add(dr[pKeyCol.ColumnName]);
}
DataRow newRow = editTable.NewRow();
if (pKeyVals.Count > 0 && grinData.Tables[((DataviewProperties)ux_tabcontrolCTDataviews.SelectedTab.Tag).DataviewName].Rows.Contains(pKeyVals.ToArray()))
{
newRow.ItemArray = grinData.Tables[((DataviewProperties)ux_tabcontrolCTDataviews.SelectedTab.Tag).DataviewName].Rows.Find(pKeyVals.ToArray()).ItemArray;
editTable.Rows.Add(newRow);
}
}
editTable.AcceptChanges();
// Drop the original datatable and add the new one...
grinData.Tables.Remove(((DataviewProperties)ux_tabcontrolCTDataviews.SelectedTab.Tag).DataviewName);
grinData.Tables.Add(editTable);
//ux_datagridviewMain.ResumeLayout();
// Create the editable DGV...
// buildEditDataGridView(ux_datagridviewMain, grinData.Tables[((DataviewProperties)ux_tabcontrolDataview.SelectedTab.Tag).DataviewName]);
_sharedUtils.BuildEditDataGridView(ux_datagridviewMain, grinData.Tables[((DataviewProperties)ux_tabcontrolCTDataviews.SelectedTab.Tag).DataviewName]);
//ux_datagridviewMain.DataSource = grinData.Tables[((DataviewProperties)ux_tabcontrolDataview.SelectedTab.Tag).DataviewName];
// Refresh formatting on the new DGV...
RefreshMainDGVFormatting();
// Restore the column widths to match the Read-Only settings (this is done only once during the building
// of the Edit DGV - it is not performed in the normal 'RefreshMainDGVFormatting' method...
string[] columnWidths = _sharedUtils.GetUserSetting("", ((DataviewProperties)ux_tabcontrolCTDataviews.SelectedTab.Tag).DataviewName, "Columns.Width", "").Split(' ');
string[] columnOrder = _sharedUtils.GetUserSetting("", ((DataviewProperties)ux_tabcontrolCTDataviews.SelectedTab.Tag).DataviewName, "Columns.DisplayOrder", "").Split(' ');
int columnNum = -1;
if (columnWidths.Length == columnOrder.Length && columnWidths.Length == ux_datagridviewMain.Columns.Count)
{
for (int i = 0; i < ux_datagridviewMain.Columns.Count; i++)
{
if (int.TryParse(columnWidths[i], out columnNum)) ux_datagridviewMain.Columns[i].Width = columnNum;// Convert.ToInt32(columnWidths[i]);
if (int.TryParse(columnOrder[i], out columnNum)) ux_datagridviewMain.Columns[i].DisplayIndex = columnNum;// Convert.ToInt32(columnOrder[i]);
}
}
// Restore the DGV to show the leftmost visible column (this was the leftmost visible column in Read-Only mode)...
if (ux_datagridviewMain.Rows.Count > 0)
{
ux_datagridviewMain.FirstDisplayedScrollingColumnIndex = firstVisibleColumn;
ux_datagridviewMain.CurrentCell = ux_datagridviewMain[firstVisibleColumn, currentRow];
ux_datagridviewMain.CurrentCell.Selected = true;
}
// Prepare the grid view for handling cell edits...
ux_datagridviewMain.Enabled = true;
ux_datagridviewMain.Focus();
ux_datagridviewMain.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;
ux_datagridviewMain.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2;
//ux_datagridviewMain.AllowUserToAddRows = true;
ux_datagridviewMain.AllowUserToDeleteRows = true;
ux_datagridviewMain.AllowDrop = true;
//.........这里部分代码省略.........