本文整理汇总了C#中Coords.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Coords.GetHashCode方法的具体用法?C# Coords.GetHashCode怎么用?C# Coords.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coords
的用法示例。
在下文中一共展示了Coords.GetHashCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRow
public static void AddRow(ObjectXML objectXML)
{
if (objectXML.rowNum < MainWindow.MaxRow)
{
for (int i = 0; i < objectXML.colNum; i++)
{
Coords t = new Coords(objectXML.rowNum, i);
objectXML.cells.Add(t.GetHashCode(), new TabCell());
}
objectXML.rowNum++;
MainWindow.objectXML = objectXML;
}
}
示例2: AddCol
public static void AddCol(ObjectXML objectXML)
{
if (objectXML.colNum < MainWindow.MaxCol)
{
Coords temp = new Coords(0, objectXML.colNum);
objectXML.header.Add(temp.GetHashCode(), new HeaderCell());
for (int i = 1; i < objectXML.rowNum; i++)
{
objectXML.cells.Add(new Coords(i, objectXML.colNum).GetHashCode(), new TabCell());
}
objectXML.colNum++;
MainWindow.objectXML = objectXML;
}
}
示例3: AddCol
public static void AddCol(ObjectXML objectXML, Coords LastActive)
{
if (objectXML.colNum < MainWindow.MaxCol)
{
Coords temp = new Coords(0, objectXML.colNum);
objectXML.header.Add(temp.GetHashCode(), new HeaderCell());
for (int i = 1; i < objectXML.rowNum; i++)
{
temp = new Coords(i, objectXML.colNum);
objectXML.cells.Add(temp.GetHashCode(), new TabCell());
}
objectXML.colNum++;
for (int col = objectXML.colNum - 1; col > LastActive.colCoord; col--)
{
objectXML.header[new Coords(0, col).GetHashCode()] = objectXML.header[new Coords(0, col - 1).GetHashCode()];
}
objectXML.header[new Coords(0, LastActive.colCoord + 1).GetHashCode()] = new HeaderCell();
for (int row = 1; row < objectXML.rowNum; row++)
{
for (int col = objectXML.colNum - 1; col > LastActive.colCoord; col--)
{
objectXML.cells[new Coords(row, col).GetHashCode()] = objectXML.cells[new Coords(row, col - 1).GetHashCode()];
}
}
for (int row = 0; row < objectXML.rowNum; row++)//если поменять на -- то будет драть МНОГО памяти
{
objectXML.cells[new Coords(row, LastActive.colCoord + 1).GetHashCode()] = new TabCell();
}
MainWindow.objectXML = objectXML;
}
}
示例4: AddRow
public static void AddRow(ObjectXML objectXML, Coords LastActive)
{
if (objectXML.rowNum < MainWindow.MaxRow)
{
for (int i = 0; i < objectXML.colNum; i++)
{
Coords t = new Coords(objectXML.rowNum, i);
objectXML.cells.Add(t.GetHashCode(), new TabCell());
}
objectXML.rowNum++;
for (int row = objectXML.rowNum - 1; row > LastActive.rowCoord; row--)
{
for (int col = 0; col < objectXML.colNum; col++)
{
if (row > 1)
{
objectXML.cells[new Coords(row, col).GetHashCode()] = objectXML.cells[new Coords(row - 1, col).GetHashCode()];
}
}
}
for (int col = 0; col < objectXML.colNum; col++)
{
objectXML.cells[new Coords(LastActive.rowCoord + 1, col).GetHashCode()] = new TabCell();
}
MainWindow.objectXML = objectXML;
}
}
示例5: AlignChange
private static void AlignChange(ref Button btn, Coords coord)
{
string temp;
if (coord.rowCoord == 0) temp = MainWindow.objectXML.header[coord.GetHashCode()].headerCellAlign;
else temp = MainWindow.objectXML.cells[coord.GetHashCode()].tabCellAlign;
switch (temp)
{
case "Center":
btn.HorizontalContentAlignment = HorizontalAlignment.Center;
btn.VerticalContentAlignment = VerticalAlignment.Center;
break;
case "Left":
btn.HorizontalContentAlignment = HorizontalAlignment.Left;
btn.VerticalContentAlignment = VerticalAlignment.Center;
break;
case "Right":
btn.HorizontalContentAlignment = HorizontalAlignment.Right;
btn.VerticalContentAlignment = VerticalAlignment.Center;
break;
case "Top":
btn.HorizontalContentAlignment = HorizontalAlignment.Center;
btn.VerticalContentAlignment = VerticalAlignment.Top;
break;
case "Bottom":
btn.HorizontalContentAlignment = HorizontalAlignment.Center;
btn.VerticalContentAlignment = VerticalAlignment.Bottom;
break;
default:
btn.HorizontalContentAlignment = HorizontalAlignment.Center;
btn.VerticalContentAlignment = VerticalAlignment.Center;
break;
}
}
示例6: DisplayXML
internal static void DisplayXML(ListBox ListBox1, ObjectXML table)
{
ListBox1.Items.Clear();
StackPanel panel1 = new StackPanel();
panel1.Orientation = Orientation.Horizontal;
ListBox1.VerticalAlignment = VerticalAlignment.Center;
ListBox1.HorizontalAlignment = HorizontalAlignment.Center;
for (int col = 0; col < table.colNum; col++)
{
Button button = new Button();
Coords coords = new Coords(0, col);
button.Name = "field" + '_' + (col + 1).ToString() + '_' + 0.ToString();
button.DataContext = MainWindow.objectXML.header[coords.GetHashCode()];
button.SetBinding(Button.ContentProperty, new Binding("headerCellHeader"));
button.SetBinding(Button.HeightProperty, new Binding("headerCellHeight"));
button.SetBinding(Button.WidthProperty, new Binding("headerCellWidth"));
button.SetBinding(Button.FontSizeProperty, new Binding("headerCellFontSize"));
button.Click += EditHeaderClick;
button.Foreground = Brushes.Black;
AlignChange(ref button, coords);
getRes(button);
button.Padding = new Thickness(5, 0, 5, 0);
button.Background = Brushes.LightGray;
button.BorderBrush = Brushes.Black;
if (coords.Equals(MainWindow.LastActiveCoords)) button.Background = Brushes.LightSkyBlue;
panel1.Children.Add(button);
}
ListBox1.Items.Add(panel1);
for (int row = 1; row < table.rowNum; row++)
{
StackPanel panel = new StackPanel();
panel.Orientation = Orientation.Horizontal;
for (int col = 0; col < table.colNum; col++)
{
Button button = new Button();
Coords coords = new Coords(row, col);
Binding bindParam = new Binding();
bindParam.Source = MainWindow.objectXML.cells[coords.GetHashCode()];
bindParam.Path = new PropertyPath("tabCellParametr");
button.Name = "field" + '_' + (col + 1).ToString() + '_' + row.ToString();
button.SetBinding(Button.ContentProperty,bindParam);
button.DataContext = MainWindow.objectXML.header[new Coords(0, col).GetHashCode()];
button.SetBinding(Button.HeightProperty, new Binding("headerCellHeight"));
button.SetBinding(Button.WidthProperty, new Binding("headerCellWidth"));
button.SetBinding(Button.FontSizeProperty, new Binding("headerCellFontSize"));
button.Foreground = Brushes.Black;
button.Padding = new Thickness(5, 0, 5, 0);
button.Click += EditCellClick;
getRes(button);
AlignChange(ref button, coords);
button.Background = Brushes.LightGray;
button.BorderBrush = Brushes.Black;
if (coords.Equals(MainWindow.LastActiveCoords)) button.Background = Brushes.LightSkyBlue;
panel.Children.Add(button);
}
ListBox1.Items.Add(panel);
}
}
示例7: WriteXml
public static bool WriteXml(ObjectXML objectXml, string filename)
{
if (filename == null || filename == "") return true;
XDocument doc = new XDocument();
XElement Root = new XElement("DataSetTable");
doc.Add(Root);
XElement Header = new XElement("TabColumns");
for (int col = 0; col < objectXml.header.Count; col++)
{
Coords coords = new Coords(0, col);
Header.Add(new XElement("TabColumn",
new XAttribute("Name", objectXml.header[coords.GetHashCode()].headerCellName),
new XAttribute("Fontsize", objectXml.header[coords.GetHashCode()].headerCellFontSize),
new XAttribute("Height", objectXml.header[coords.GetHashCode()].headerCellHeight),
new XAttribute("Width", objectXml.header[coords.GetHashCode()].headerCellWidth),
new XAttribute("Align", objectXml.header[coords.GetHashCode()].headerCellAlign),
new XAttribute("Header", objectXml.header[coords.GetHashCode()].headerCellHeader)));
}
doc.Root.Add(Header);
for (int row = 1; row < objectXml.rowNum; row++)
{
XElement tableRow;
if (objectXml.cells[new Coords(row, 0).GetHashCode()].Name != " " && objectXml.cells[new Coords(row, 0).GetHashCode()].Name!=null)
{
tableRow = new XElement("TabRow",
new XAttribute("Name", objectXml.cells[new Coords(row, 0).GetHashCode()].Name),
new XAttribute("Number", objectXml.cells[new Coords(row, 0).GetHashCode()].Number));
}
else
{
tableRow = new XElement("TabRow");
}
for (int col = 0; col < objectXml.colNum; col++)
{
Coords coords = new Coords(row, col);
tableRow.Add(new XElement("TabCell",
new XAttribute("Align", objectXml.cells[coords.GetHashCode()].tabCellAlign),
new XAttribute("Precision", objectXml.cells[coords.GetHashCode()].tabCellPrecision),
new XAttribute("Parametr", objectXml.cells[coords.GetHashCode()].tabCellParametr)));
}
doc.Root.Add(tableRow);
}
filename = MainWindow.PathXML;
if (filename == null || filename == "") return false;
doc.Save(filename);
return true;
}
示例8: ReadXMLHeader
public static Dictionary<int, HeaderCell> ReadXMLHeader(string FileName)
{
Dictionary<int, HeaderCell> HeaderCells = new Dictionary<int, HeaderCell>();
XDocument xdoc = new XDocument();
xdoc = XDocument.Load(FileName);
int col = 0, row = 0;
HeaderCell temp;
Coords coordinate;
foreach (XElement el in xdoc.Root.Element("TabColumns").Elements())
{
temp = new HeaderCell();
temp.headerCellAlign = el.Attribute("Align").Value;
temp.headerCellName = el.Attribute("Name").Value;
int t;
if (int.TryParse(el.Attribute("Fontsize").Value, out t))
{
temp.headerCellFontSize = t;
}
if (int.TryParse(el.Attribute("Height").Value, out t))
{
temp.headerCellHeight = t;
}
if (int.TryParse(el.Attribute("Width").Value, out t))
{
temp.headerCellWidth = t;
}
temp.headerCellHeader = el.Attribute("Header").Value;
coordinate = new Coords(row, col);
HeaderCells.Add(coordinate.GetHashCode(), temp);
col++;
}
return HeaderCells;
}
示例9: ReadXMLCells
public static Dictionary<int, TabCell> ReadXMLCells(string FileName)
{
Dictionary<int, TabCell> TabCells = new Dictionary<int, TabCell>();
XDocument xdoc = XDocument.Load(FileName);
int row = 1;
int col = 0;
string RowName = "";
string RowNumber = "";
foreach (XElement el in xdoc.Root.Elements("TabRow"))
{
if (el.HasAttributes)
{
RowName = el.Attribute("Name").Value;
RowNumber = el.Attribute("Number").Value;
}
else
{
RowName = " ";
RowNumber = " ";
}
foreach (XElement elem in el.Elements())
{
TabCell temp = new TabCell();
Coords coordinate = new Coords(row, col);
temp.tabCellAlign = elem.Attribute("Align").Value;
temp.tabCellParametr = elem.Attribute("Parametr").Value;
temp.tabCellPrecision = elem.Attribute("Precision").Value;
temp.Name = RowName;
temp.Number = RowNumber;
TabCells.Add(coordinate.GetHashCode(), temp);
col++;
temp = null;
}
col = 0;
row++;
}
return TabCells;
}
示例10: DelRow
public static void DelRow(ObjectXML objectXML, Coords LastActive)
{
if (LastActive.rowCoord != 0 && objectXML.rowNum > 2)
{
if (LastActive.rowCoord < (objectXML.rowNum - 1))
{
for (int row = LastActive.rowCoord; row < objectXML.rowNum - 2; row++)
{
for (int col = 0; col < objectXML.colNum; col++)
{
Coords temp = new Coords(row, col);
objectXML.cells[temp.GetHashCode()] = objectXML.cells[new Coords(row + 1, col).GetHashCode()];
}
}
}
for (int i = 0; i < objectXML.colNum; i++)
{
objectXML.cells.Remove(new Coords(objectXML.rowNum - 1, i).GetHashCode());
}
objectXML.rowNum--;
if (MainWindow.LastActiveCoords.rowCoord > objectXML.rowNum - 1)
MainWindow.LastActiveCoords.rowCoord = objectXML.rowNum - 1;
MainWindow.objectXML = objectXML;
}
else return;
}
示例11: DelCol
public static void DelCol(ObjectXML objectXML, Coords LastActive)
{
if (objectXML.colNum > 1)
{
for (int col = LastActive.colCoord; col < objectXML.colNum - 2; col++)
{
objectXML.header[new Coords(0, col).GetHashCode()] = objectXML.header[new Coords(0, col + 1).GetHashCode()];
}
Coords temp = new Coords(0, objectXML.colNum - 1);
objectXML.header.Remove(temp.GetHashCode());
for (int row = 1; row < objectXML.rowNum; row++)
{
for (int col = LastActive.colCoord; col < objectXML.colNum - 2; col++)
{
objectXML.cells[new Coords(row, col).GetHashCode()] = objectXML.cells[new Coords(row, col + 1).GetHashCode()];
}
objectXML.cells.Remove(new Coords(row, objectXML.colNum - 1).GetHashCode());
}
objectXML.colNum--;
if (MainWindow.LastActiveCoords.colCoord > objectXML.colNum - 1)
MainWindow.LastActiveCoords.colCoord = objectXML.colNum - 1;
MainWindow.objectXML = objectXML;
}
}
示例12: DisplayXML
internal static void DisplayXML(ListBox ListBox1, ObjectXML table)
{
ListBox1.Items.Clear();
StackPanel panel1 = new StackPanel();
panel1.Orientation = Orientation.Horizontal;
for (int col = 0; col < table.colNum; col++)
{
Button button = new Button();
Coords coords= new Coords(0, col);
button.Name = "field" + '_' + (col + 1).ToString() + '_' + 0.ToString();
button.Content = table.header[coords.GetHashCode()].headerCellHeader;
button.Height = 30;
button.Width = 150;
button.Click += EditHeaderClick;
getRes(button);
button.Background=Brushes.LightGray;
button.BorderBrush = Brushes.Black;
panel1.Children.Add(button);
}
ListBox1.Items.Add(panel1);
for (int row=1; row < table.rowNum; row++)
{
StackPanel panel = new StackPanel();
panel.Orientation = Orientation.Horizontal;
for (int col = 0; col < table.colNum; col++)
{
Button button = new Button();
Coords coords = new Coords(row, col);
button.Name = "field"+'_'+(col+1).ToString() + '_'+row.ToString();
button.Content = table.cells[coords.GetHashCode()].tabCellParametr;
button.Height = 30;
button.Width = 150;
button.Click += EditCellClick;
getRes(button);
button.Background = Brushes.LightGray;
button.BorderBrush = Brushes.Black;
panel.Children.Add(button);
}
ListBox1.Items.Add(panel);
}
}
示例13: ReadXMLCells
public static Dictionary<int, TabCell> ReadXMLCells(string FileName)
{
Dictionary<int, TabCell> TabCells = new Dictionary<int, TabCell> ();
XDocument xdoc = XDocument.Load(FileName);
int row = 1;
int col = 0;
string RowName = "";
string RowNumber = "";
foreach (XElement el in xdoc.Root.Elements("TabRow"))
{
try
{
RowName = el.Attribute("Name").Value;
RowNumber = el.Attribute("Number").Value;
}
catch
{
RowName = " ";
RowNumber = " ";
}
foreach (XElement elem in el.Elements())
{
TabCell temp = new TabCell();
Coords coordinate = new Coords(row, col);
temp.tabCellAlign = elem.Attribute("Align").Value;
temp.tabCellParametr = elem.Attribute("Parametr").Value;
temp.tabCellPrecision = elem.Attribute("Precision").Value;
temp.Name = RowName;
temp.Number = RowNumber;
try
{
TabCells.Add(coordinate.GetHashCode(), temp);
}
catch (ArgumentException)
{
Console.WriteLine("An element with Key = \"txt\" already exists.");
}
col++;
temp = null;
}
col = 0;
row++;
}
return TabCells;
}
示例14: EditHeaderClick
public static void EditHeaderClick(object sender, RoutedEventArgs e)
{
Coords t = new Coords();
t = GetCoords((sender as Button).Name.ToString());
EditHeaderCell w = new EditHeaderCell();
ObjectXML xml = new ObjectXML();
xml = MainWindow.GetObjectXML();
HeaderCell cell = xml.header[t.GetHashCode()];
OpenEditHeaderCellWindow(w, cell,t);
}
示例15: DelCol
public static void DelCol(ObjectXML objectXML)
{
if (objectXML.colNum>1){
Coords temp = new Coords(0, objectXML.colNum - 1);
objectXML.header.Remove(temp.GetHashCode());
for (int i = 1; i < objectXML.rowNum; i++)
{
objectXML.cells.Remove(new Coords(i, objectXML.colNum - 1).GetHashCode());
}
objectXML.colNum--;
MainWindow.objectXML = objectXML;
}
}