public static bool luhn_checksum(List<int> card_number_array) { int checksum = 0; //adds up all the even placed digits for (int i = 0; i < card_number_array.Count(); i = i + 2) { checksum += card_number_array[i]; } int index2 = 0; //now adds up (2 x odd placed digits) for (int i = 1; i < card_number_array.Count(); i = i + 2) { index2 = card_number_array[i] * 2; if (index2 >= 10) { index2 = index2 - 9; // if 2 x digit > 10 } checksum += index2; } if (checksum % 10 == 0) { return true; } else { return false; } }
private int[,] CellsToArray(List<List<Cell>> cells) { var result = new int[cells.Count(), cells.Max(cellsRow => cellsRow.Count())]; for (int x = 0; x < cells.Count(); ++x) { for (int y = 0; y < cells[x].Count(); ++y) { result[x, y] = cells[x][y].Value; } } return result; }
public Histogram(List<double> vals, string name, double binSize = 0) { this.vals = vals; InitializeComponent(); this.DataContext = this; //this.YAxis = new LinearAxis(AxisPosition.Left, name); if (binSize == 0) { binSize = Math.Round( 3.49 * vals.StandardDev() * Math.Pow(vals.Count(), -.33333), 3); } this.title = name; draw(binSize); this.NumberOfDataPoints = vals.Count(); }
public Results(List<Items> result, String searchWord) { InitializeComponent(); initResults = result; resultList = result; if(searchWord.Length == 0) { dialogMessage.Text = "You did not search for anything.\nPlease try again."; keywordLabel.Text = searchWord; resultSearch.Text = searchWord; resultList = null; return; } if(searchWord.Length != 0) { clearButton.Visibility = Visibility.Visible; } if (result.Count() > 10) { dialogMessage.Text = "Your search returned more than 10 results.\n\nYou may wish to make your search more specific to return less."; resultsListBox.ItemsSource = result; keywordLabel.Text = searchWord; resultSearch.Text = searchWord; sortLabel.Visibility = Visibility.Visible; sortOptions.Visibility = Visibility.Visible; locationLabel.Visibility = Visibility.Visible; } else if (result.Count() != 0) { resultsListBox.ItemsSource = result; keywordLabel.Text = searchWord; resultSearch.Text = searchWord; sortLabel.Visibility = Visibility.Visible; sortOptions.Visibility = Visibility.Visible; locationLabel.Visibility = Visibility.Visible; } else { dialogMessage.Text = "Your search returned 0 results.\n\nThe product you're looking for may:\n - Not be sold here, or\n - You may have made a spelling mistake."; keywordLabel.Text = searchWord; resultSearch.Text = searchWord; } }
public ChartLineUC(List<DataPointCollection> ListDataPoints, string[] zstr, string strtitle) { InitializeComponent(); chartC.DataPointWidth = 2; Title title = new Title(); title.Text = strtitle; chartC.Titles.Add(title); for (int i = 0; i < ListDataPoints.Count(); i++) { DataPointCollection dpc = ListDataPoints[i]; chartC.Series[i].DataPoints = dpc; chartC.Series[i].LegendText = zstr[i]; chartC.Series[i].ShowInLegend = true; chartC.Series[i].ToolTipText = string.Format("名称:#AxisXLabel {0}数值:#YValue {0}", System.Environment.NewLine); chartC.Series[i].AutoFitToPlotArea = true; chartC.Series[i].LabelEnabled = false; chartC.Series[i].Bevel = false; chartC.Series[i].ShadowEnabled = true; chartC.Series[i].YValueFormatString = "######.## "; chartC.Series[i].LightingEnabled = true; chartC.Series[i].LabelText = " #AxisXLabel"; chartC.Series[i].LabelFontSize = 13; chartC.Series[i].IncludePercentageInLegend = true; } }
private void Button_Click_1(object sender, RoutedEventArgs e) { List<ExportRowHelper> ExportColumnNames = new List<ExportRowHelper>(); foreach (var item in ufgMain.Children) { CheckBox cb = item as CheckBox; if (cb.IsChecked.Value) { ExportColumnNames.Add(new ExportRowHelper() { ColumnName = cb.Tag.ToString(), ColumnValue = cb.Content.ToString() }); } } if (ExportColumnNames.Count() <= 0) { Common.MessageBox.Show("请选择需要导出的列"); return; } SaveFileDialog sfd = new SaveFileDialog(); sfd.FileName = string.Format("GlassID导出列表.xls"); if (sfd.ShowDialog() == true) { string filename = sfd.FileName; string ErrMsg = string.Empty; bool bSucc = false; bSucc = _export.ExportGlassIDToExcel(_lst, ExportColumnNames, filename, ref ErrMsg); if (bSucc) { var process = System.Diagnostics.Process.Start(filename); } else Common.MessageBox.Show(ErrMsg); } this.Close(); }
public static string[] GetLayerList(XElement xEle) { List<string> lst = new List<string>(); XNamespace aw = xEle.GetDefaultNamespace(); IEnumerable<XElement> de = from el in xEle.Descendants(aw + "Layer") select el; foreach (XElement el in de) { if (el.Elements(aw + "Name").Count() > 0) { lst.Add(el.Elements(aw + "Name").First().Value); } } if (lst.Count() > 0) { string[] lyrList = new string[lst.Count]; for (int i = 0; i < lst.Count; i++) { lyrList[i] = lst[i]; } return lyrList; } return null; }
public ScoreWindow(List<Game> games) { InitializeComponent(); int cols = 4; int rows = games.Count(); for (int c = 0; c < cols; c++) myTable.Columns.Add(new TableColumn()); TableRow tr0 = new TableRow(); tr0.Cells.Add(new TableCell(new Paragraph(new Run("Gra")))); tr0.Cells.Add(new TableCell(new Paragraph(new Run("Minimalny pomiar")))); tr0.Cells.Add(new TableCell(new Paragraph(new Run("Maksymalny pomiar")))); tr0.Cells.Add(new TableCell(new Paragraph(new Run("Odchylenie standardowe")))); TableRowGroup trg0 = new TableRowGroup(); trg0.Rows.Add(tr0); myTable.RowGroups.Add(trg0); foreach (Game g in games) { if (g.getMaximum() == Double.MinValue) continue; TableRow tr = new TableRow(); tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getName())))); tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getMinimum().ToString("N3"))))); tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getMaximum().ToString("N3"))))); tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getDeviation().ToString("N3"))))); TableRowGroup trg = new TableRowGroup(); trg.Rows.Add(tr); myTable.RowGroups.Add(trg); } }
private void ZoomToShowAll(List<LineModule> sampleTrackingModules) { int countTlane = sampleTrackingModules.Count(a => a is LaneT); mScale = 1; if(countTlane >= 7) { mScale = 6; } if (countTlane >= 8) { mScale = 0.8; } if (countTlane >= 10) { mScale = 0.7; } if (countTlane >= 12) { mScale = 0.6; } if (countTlane >= 14) { mScale = 0.5; } viewbox.LayoutTransform = new ScaleTransform(mScale, mScale); }
private Boolean validado(Object obj) { ValidationContext validationContext = new ValidationContext(obj, null, null); List<System.ComponentModel.DataAnnotations.ValidationResult> errors = new List<System.ComponentModel.DataAnnotations.ValidationResult>(); Validator.TryValidateObject(obj, validationContext, errors, true); if (errors.Count() > 0) { string mensageErrores = string.Empty; foreach (var error in errors) { error.MemberNames.First(); mensageErrores += error.ErrorMessage + Environment.NewLine; } MessageBox.Show(mensageErrores); return false; } else { return true; } }
// Напечатаем окно заказа: private void НапечататьЗаказы(object sender, RoutedEventArgs e) { // Очистим окно и заново добавим,указав для каждого продукта:сколько его заказали if (СписокЗаказов.Count>0) { var новыеЗаказы = new List<Заказ>(); foreach (var заказ in СписокЗаказов) { if (новыеЗаказы.Count(x => x == заказ) == 0) новыеЗаказы.Add(заказ); } ОкноВывода.Items.Clear(); int sum = 0; foreach (var заказ in новыеЗаказы) { var количетсво = СписокЗаказов.Count(x => x == заказ); sum += заказ.цена * количетсво; ОкноВывода.Items.Add(" " + заказ.продукт + "(" + заказ.цена + "р.): " + количетсво + "штук(и) = " + заказ.цена * количетсво); } ОкноВывода.Items.Add("Сумма: " + sum + "р."); } else { ОкноВывода.Items.Add("Заказов нет!"); } }
// Напечатаем окно заказа: private void Итого_Click(object sender, RoutedEventArgs e) { // Очистим окно и заново добавим,указав для каждого продукта:сколько его заказали if (Заказы.Count>0) { var новыеЗаказы = new List<ПродуктЦена>(); foreach (var заказ in Заказы) { if (новыеЗаказы.Count(x => x == заказ) == 0) новыеЗаказы.Add(заказ); } ОкноВывода.Items.Clear(); int sum = 0; foreach (var заказ in новыеЗаказы) { var количетсво = Заказы.Count(x => x == заказ); sum += заказ.цена * количетсво; ОкноВывода.Items.Add("-> " + заказ.product + "(" + заказ.цена + "р.): " + количетсво + "штук(и) = " + заказ.цена * количетсво); } ОкноВывода.Items.Add("Сумма к оплате: " + sum + "р."); } else { ОкноВывода.Items.Add("Заказы отсутствуют"); } }
private void BubbleCurrentSelection(object _nothing) { var slide = Globals.slide; var currentDetails = Globals.conversationDetails; string target = null; var selection = new List<SelectedIdentity>(); foreach(var registeredCommand in Commands.DoWithCurrentSelection.RegisteredCommands) registeredCommand.Execute((Action<SelectedIdentity>)(id=>{ target = id.target; selection.Add(id); })); if (selection.Count() > 0) { var details = ConversationDetailsProviderFactory.Provider.AppendSlideAfter(Globals.slide, currentDetails.Jid, Slide.TYPE.THOUGHT); var newSlide = details.Slides.Select(s => s.id).Max(); Commands.SendNewBubble.Execute(new TargettedBubbleContext { author = Globals.me, context = selection, privacy = "public", slide = slide, target = target, thoughtSlide =newSlide }); } }
private void buttonSave_Click(object sender, RoutedEventArgs e) { List<Figuur> GewijzigdeFiguren = new List<Figuur>(); foreach (Figuur f in figuren) { if (f.Changed == true) GewijzigdeFiguren.Add(f); f.Changed = false; } if(GewijzigdeFiguren.Count() != 0) { FiguurManager manager = new FiguurManager(); try { manager.SChrijfWijzigingen(GewijzigdeFiguren); } catch (Exception ex) { MessageBox.Show(ex.Message); } } GewijzigdeFiguren.Clear(); }
private void allButton_Click(object sender, RoutedEventArgs e) { List<ManagePlaylist.File> tmp = new List<ManagePlaylist.File>(); filterAll(tmp); playListBox.Items.Clear(); for (int i = 0; i < tmp.Count(); ++i) { playListBox.Items.Add(getName(tmp[i].Path)); } }
public void AddMoreContacts(List<ContactDB> list) { if (!Application.Current.Dispatcher.CheckAccess()) { Application.Current.Dispatcher.BeginInvoke( DispatcherPriority.Background, new Action(() => AddMoreContacts(list))); return; } if (list != null && list.Count() > 0) { DuplicateContactMode mode = printerController.GetDuplicateContactMode(); if (mode != DuplicateContactMode.ALLOW_ADD_NEW) { int len = list.Count(); for (int i = 0; i < len;) { int dupIdx = FindDuplicateContact(list[i]); if (dupIdx > 0) { switch (mode) { case DuplicateContactMode.REPLACE_WITH_NEW_ITEM: uc_AddressBook.ListAllContact.RemoveAt(dupIdx); break; case DuplicateContactMode.DO_NOT_IMPORT: list.RemoveAt(i); len--; continue; } } i++; } } uc_AddressBook.ListAllContact.AddRange(list); UpdateListGroupName(list); LoadContacts(); } }
void ListOrganisationCompleted(List<Organisation> orgList) { Globals.IsBusy = false; _originalItemSource.Clear(); foreach (Organisation item in orgList) { item.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OrganisationItem_PropertyChanged); _originalItemSource.Add(item); } gvwOrganisations.ItemsSource = orgList; if (_seletedOrgId > 0 && orgList.Count(i => i.OrganisationId == _seletedOrgId) > 0) { gvwOrganisations.SelectedItem = orgList.First(i => i.OrganisationId == _seletedOrgId); } else if (orgList.Count > 0) { gvwOrganisations.SelectedItem = orgList[0]; } }
public void addBall(List<int> weightsArray) { int cheating = 20; if (weightsArray.Count() > 3) { newBall(0, top, left, weightsArray[0]); locations[0].X = left; locations[0].Y = top; newBall(1, top, left + gap, weightsArray[1]); locations[1].X = left + gap; locations[1].Y = top; newBall(2, top + gap, left, weightsArray[2]); locations[2].X = left + cheating; locations[2].Y = top + gap; newBall(3, top + gap, left + gap, weightsArray[3]); locations[3].X = left + gap + cheating; locations[3].Y = top + gap; } }
public ExportGarminCommunicatorWindow(List<Core.Data.Geocache> gcList) : this() { _gcList = gcList; progBar.Maximum = gcList.Count(); webBrowser1.ObjectForScripting = new webBrowserScriptingCallback(this); webBrowser1.LoadCompleted += webBrowser1_LoadCompleted; webBrowser1.Navigated += webBrowser1_Navigated; //DisplayHtml(Utils.ResourceHelper.GetEmbeddedTextFile("/GPX/ExportGarminCommunicatorWindow.html")); try { System.IO.TemporaryFile tmpFile = new System.IO.TemporaryFile(true); Utils.ResourceHelper.SaveToFile("/GPX/ExportGarminCommunicatorWindow.html", tmpFile.Path, true); webBrowser1.Navigate(string.Format("file://{0}", tmpFile.Path)); } catch(Exception e) { Core.ApplicationData.Instance.Logger.AddLog(this, e); } }
public void GetTrips(IEnumerable<string> tripIds, Action callback) { List<string> notFoundTripIds = new List<string>(); foreach (string tripId in tripIds) { if( !_cache.ContainsKey( tripId ) ) { notFoundTripIds.Add(tripId); } } if (notFoundTripIds.Count() > 0) { RestRequest request = new RestRequest(); request.Resource = "trips"; request.AddParameter("tripIds", ToCSV(notFoundTripIds)); request.DateFormat = "HH:mm:ss"; App.GrtApiClient.Execute<List<Trip>>( request, (callbackData) => { foreach (var element in callbackData.Data) { if (_cache.ContainsKey(element.tripId)) { _cache[element.tripId] = element; } else { _cache.Add(element.tripId, element); } } callback.Invoke(); } ); } else { callback.Invoke(); } }
public void SetDataSource(List<Dictionary<string, object>> dataSource) { if (dataSource == null || dataSource.Count == 0) { return; } this.SearchChartView.ClearPoints(); var entry0 = dataSource[0]; var entryf = dataSource.Last(); DateTime beginTime = DateTime.Parse((string)entry0["time"]); DateTime finalTime = DateTime.Parse((string)entryf["time"]); this.SearchChartView.UpdateTimeAxis(beginTime, finalTime, dataSource, dataSource.Count()); this.SearchChartView.SetDataPoints(dataSource); /* foreach (var e in dataSource) { this.SearchChartView.AddCurvesDataPoint(e); } */ }
/// <summary> /// transform a list of coordinate in a scatterviewitem /// </summary> /// <param name="coord"></param> public ScatterViewItem createScatterViewItem(List<int> coord) { ScatterViewItem myShape = new ScatterViewItem(); //create the pathGeometry if (coord != null) { PathFigure myPathFigure = new PathFigure(); myPathFigure.StartPoint = new Point(coord[0], coord[1]); PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection(); for (int i = 2; i < coord.Count(); i = i + 2) { LineSegment myLineSegment = new LineSegment(); myLineSegment.Point = new Point(coord[i], coord[i + 1]); myPathSegmentCollection.Add(myLineSegment); } myPathFigure.Segments = myPathSegmentCollection; PathFigureCollection myPathFigureCollection = new PathFigureCollection(); myPathFigureCollection.Add(myPathFigure); PathGeometry myPathGeometry = new PathGeometry(); myPathGeometry.Figures = myPathFigureCollection; //create the path System.Windows.Shapes.Path myPath = new System.Windows.Shapes.Path(); myPath.Stroke = Brushes.Black; myPath.StrokeThickness = 1; myPath.Data = myPathGeometry; myPath.Fill = new SolidColorBrush(Colors.Blue); //create the scatterViewItem myShape.Content = myPath; myShape.Width = this.max(coord); myShape.Height = this.max(coord); } return myShape; }
public FlowDocument ShowContainers(List<Container> containers, List<Vehicle> vehicles) { var doc = new FlowDocument(); foreach (var vehicle in vehicles) { var tempList = UnpackVehicle(vehicle); AddMainHeader(doc, "Список контейнеров для автомобиля " + vehicle.Name + "(" + tempList.Count() + " контейнеров; общий вес груза " + vehicle.Mass + " кг.)"); AddTable(doc, tempList); } if (containers.Any()) { AddMainHeader(doc, "Список контейнеров не поместившихся в машины " + "(" + containers.Count() + " контейнеров)"); AddTable(doc, containers); } else { AddMainHeader(doc, "Все контейнеры загружены."); } return doc; }
private void btn_delete_Click(object sender, RoutedEventArgs e) { int recv; byte[] rdata = new byte[1024*1024]; List<UserData> Delete_list = LUserdata.FindAll(p => { if (p.user.Ischecked) { return true; } return false; }); Delete_list.FindAll(p => { p.Count = Delete_list.Count; return true; }); Delete_list.FindAll(p => { p.Ischeckedcount = LUserdata.Count(t => t.user.Ischecked == true); return true; }); if (Delete_list.Count != 0) { string post_data = "&#D" + Delete_list.Count.ToString(); foreach (UserData item in Delete_list) { post_data = post_data + "&#" + item.user.Id + "::" + item.user.Password + "::" + ((int)item.user.Power).ToString() + "::" + ((int)item.user.State).ToString(); } byte[] tmp_data = Encoding.UTF8.GetBytes(post_data); client.Send(tmp_data); recv = client.Receive(rdata); if (Encoding.UTF8.GetString(rdata, 0, recv) == "1") { LUserdata = LUserdata.FindAll(p => { if (p.user.Ischecked) { p.user.Ischecked = false; return p.user.Id != p.user.Id; } return true; }); LUserdata.FindAll(p => { p.Count = LUserdata.Count; return true; }); LUserdata.FindAll(p => { p.Ischeckedcount = LUserdata.Count(t => t.user.Ischecked == true); return true; }); if (LUserdata.Count == 0) Tb_SelectCount.Text = "0"; UserInfo.DataContext = LUserdata; Grid_Data.DataContext = LUserdata; } else { MessageBox.Show("删除用户失败!", "警告"); } } }
void serviceClient_GetAllCompanyInfoCompleted(object sender, GetAllCompanyInfoCompletedEventArgs e) { if (e.Error!=null) { MessageBox.Show("错误信息:" +e.Error.ToString()); } else { if (e.Result!=null) { //得到员工数据 var employeeInfo = from p in e.Result select p; List<PieEmployeece> employeeceList = new List<PieEmployeece>(); foreach (var t in employeeInfo) { PieEmployeece employeece = new PieEmployeece(); //公司名字 中文名 employeece.CNAME = t.CNAME; //人数 employeece.CountEmployeece = 0; employeeceList.Add(employeece); } if (employeeceList.Count() > 0) { listPieEmployeece = employeeceList; CreatePieChart(); } else { MessageBox.Show("没有查询到数据!"); } } } }
void ListEquipmentCompleted(List<Equipment> orgList) { Globals.IsBusy = false; _originalItemSource.Clear(); foreach (Equipment item in orgList) { item.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(EquipmentItem_PropertyChanged); _originalItemSource.Add(item); } gvwEquipments.ItemsSource = orgList; if (_selectedEquipmentId > 0 && orgList.Count(i => i.EquipmentId == _selectedEquipmentId) > 0) { gvwEquipments.SelectedItem = orgList.First(i => i.EquipmentId == _selectedEquipmentId); } else if (orgList.Count > 0) { gvwEquipments.SelectedItem = orgList[0]; } }
private void BindApproval() { treeApproval.Items.Clear(); List<T_SYS_DICTIONARY> Dicts = Application.Current.Resources["SYS_DICTIONARY"] as List<T_SYS_DICTIONARY>; if (ListDicts == null) { return; } List<T_SYS_DICTIONARY> TopApproval = new List<T_SYS_DICTIONARY>(); List<T_SYS_DICTIONARY> SecondApproval = new List<T_SYS_DICTIONARY>(); List<T_SYS_DICTIONARY> ThreeApproval = new List<T_SYS_DICTIONARY>(); var ents = from p in Dicts where p.DICTIONCATEGORY == "TYPEAPPROVAL" orderby p.ORDERNUMBER select p; ListDicts = ents.Count() > 0 ? ents.ToList() : null; if (ListDicts != null) { foreach (T_SYS_DICTIONARY dict in ListDicts) { if (dict.T_SYS_DICTIONARY2 == null) { TreeViewItem item = new TreeViewItem(); item.Header = dict.DICTIONARYNAME; item.HeaderTemplate = Application.Current.Resources["OrganizationItemStyle"] as DataTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; item.DataContext = dict; item.Tag = dict; if (lsApprovalTypeValues.Contains(dict.DICTIONARYVALUE.ToString()) ) { treeApproval.Items.Add(item); TopApproval.Add(dict); } } } if (TopApproval.Count() > 0) { foreach (var topApp in TopApproval) { //存在子记录的则添加子节点 List<T_SYS_DICTIONARY> lstDict = new List<T_SYS_DICTIONARY>(); var lsents = from ent in ListDicts where ent.T_SYS_DICTIONARY2 != null && ent.T_SYS_DICTIONARY2.DICTIONARYID == topApp.DICTIONARYID select ent; if (lsents.Count() > 0) { lstDict = lsents.ToList(); TreeViewItem parentItem = GetApprovalParentItem(topApp.DICTIONARYID); AddApprovalNode(lstDict, parentItem); } } } } }
private void AddApprovalNode(List<T_SYS_DICTIONARY> lsDict, TreeViewItem FatherNode) { //绑定事项审批的子项目 foreach (var childDict in lsDict) { TreeViewItem item = new TreeViewItem(); item.Header = childDict.DICTIONARYNAME; item.HeaderTemplate = Application.Current.Resources["OrganizationItemStyle"] as DataTemplate; item.Style = Application.Current.Resources["TreeViewItemStyle"] as Style; item.DataContext = childDict; item.Tag = childDict; if (lsApprovalTypeValues.Contains(childDict.DICTIONARYVALUE.ToString())) { if(FatherNode != null) FatherNode.Items.Add(item); } if (lsDict.Count() > 0) { List<T_SYS_DICTIONARY> Dicts = Application.Current.Resources["SYS_DICTIONARY"] as List<T_SYS_DICTIONARY>; var ents = from p in Dicts where p.DICTIONCATEGORY == "TYPEAPPROVAL" orderby p.ORDERNUMBER select p; ListDicts = ents.Count() > 0 ? ents.ToList() : null; if (ListDicts == null) { return; } //存在子记录的则添加子节点 List<T_SYS_DICTIONARY> lstDict = new List<T_SYS_DICTIONARY>(); var lsents = from ent in ListDicts where ent.T_SYS_DICTIONARY2 != null && ent.T_SYS_DICTIONARY2.DICTIONARYID == childDict.DICTIONARYID && lsApprovalTypeValues.Contains(ent.DICTIONARYVALUE.ToString()) select ent; if (lsents.Count() > 0) { lstDict = lsents.ToList(); TreeViewItem parentItem = GetApprovalParentItem(childDict.DICTIONARYID); if(parentItem != null) { AddApprovalNode(lstDict, parentItem); } } } } }
public void RepaintSchedulerIfDateModifiedIsSelected(List<DateTime> datesUpdates) { if (datesUpdates.Count(du => du.Date == scheduler.SelectedDate.Date) > 0) { LoadScheduler(scheduler.SelectedDate.Date); } }
void CalculateDrawingDetails(List<List<DrawingValues>> DrawingsGrid, DrawingStandards Standards, String PictureName) { Standards.UsedFrame = GetDrawingFrame(PictureName); Standards.TargetWidth = ((double)Standards.FullWidth * ((double)Standards.UsedFrame.PositionRight - (double)Standards.UsedFrame.PositionLeft)) / 100; double FullTargetHeight = ((double)Standards.FullHeight * ((double)Standards.UsedFrame.PositionBottom - (double)Standards.UsedFrame.PositionTop)) / 100; int NumberOfLines = DrawingsGrid.Count(); if (PictureName.Contains("Sport")) { Standards.HeightUnit = FullTargetHeight / ((double)6 + 0.2); Standards.TargetHeight = Standards.HeightUnit*(NumberOfLines + 0.2); } else { Standards.HeightUnit = FullTargetHeight / ((double)11 + 0.2); Standards.TargetHeight = Standards.HeightUnit * (NumberOfLines + 0.2); } Standards.HeightUnit = Standards.TargetHeight/((double) NumberOfLines + 0.2); int NumberOfColumns = DrawingsGrid.Last().Count(); Standards.WidthUnit = Standards.TargetWidth / ((double)NumberOfColumns + 4); Standards.RowStartings = new List<double>(); Standards.ColumnStartings = new List<double>(); double MarginXValue = 4; double MarginYValue = 4; int RunningIndex = 0; foreach (List<DrawingValues> drawingValueses in DrawingsGrid) { if (RunningIndex == 0) { Standards.RowStartings.Add(0); } else if (RunningIndex == 2) { Standards.RowStartings.Add(Standards.RowStartings.Last() + (Standards.HeightUnit * 1.2)); } else Standards.RowStartings.Add(Standards.RowStartings.Last( ) + Standards.HeightUnit); if (RunningIndex > 0) { SetTop(drawingValueses, Standards.RowStartings.Last(), MarginYValue); if (RunningIndex == 1) SetBottom(drawingValueses, Standards.RowStartings.Last() + (Standards.HeightUnit*1.2), MarginYValue); else SetBottom(drawingValueses, Standards.RowStartings.Last() + Standards.HeightUnit, MarginYValue); } RunningIndex++; } RunningIndex = 0; foreach (DrawingValues drawingValues in DrawingsGrid.Last()) { if (RunningIndex == 0) { Standards.ColumnStartings.Add(0); SetLeft(GetColumnDrawingValues(DrawingsGrid, RunningIndex), 0, MarginXValue); SetRight(GetColumnDrawingValues(DrawingsGrid, RunningIndex), (Standards.WidthUnit * 5), MarginXValue); RunningIndex++; continue; } if (RunningIndex == 1) { Standards.ColumnStartings.Add(Standards.ColumnStartings[0] + (Standards.WidthUnit * 5)); SetLeft(GetColumnDrawingValues(DrawingsGrid, RunningIndex), Standards.ColumnStartings.Last(), MarginXValue); SetRight(GetColumnDrawingValues(DrawingsGrid, RunningIndex), Standards.ColumnStartings.Last() + (Standards.WidthUnit), MarginXValue); RunningIndex++; continue; } Standards.ColumnStartings.Add(Standards.ColumnStartings[RunningIndex - 1] + Standards.WidthUnit); SetLeft(GetColumnDrawingValues(DrawingsGrid, RunningIndex), Standards.ColumnStartings.Last(), MarginXValue); SetRight(GetColumnDrawingValues(DrawingsGrid, RunningIndex), Standards.ColumnStartings.Last() + (Standards.WidthUnit), MarginXValue); RunningIndex++; } DrawingsGrid[0][0].OuterTop = 0; DrawingsGrid[0][0].OuterLeft = 0; DrawingsGrid[0][0].OuterBottom = Standards.HeightUnit; DrawingsGrid[0][0].OuterRight = Standards.TargetWidth; DrawingsGrid[0][0].MarginTop = DrawingsGrid[0][0].OuterTop + MarginYValue; DrawingsGrid[0][0].MarginLeft = DrawingsGrid[0][0].OuterLeft + MarginXValue; DrawingsGrid[0][0].MarginBottom = DrawingsGrid[0][0].OuterBottom - MarginYValue; DrawingsGrid[0][0].MarginRight = DrawingsGrid[0][0].OuterRight - MarginXValue; }