public MainWindow() { InitializeComponent(); testIds = new List<string>(); BuildMsBuildProjectsFullPaths(); GetIpsInformation(); List<ProjectInfo> projectPaths = new List<ProjectInfo>() { new ProjectInfo( @"D:\AutomationTestAssistant\TestTime\TestTime.csproj") }; dgvProjects.ItemsSource = projectPaths; List<Object> workspaceInfos = new List<Object>(); var tfsInfo = new { TfsPath = "tfsTestPath", LocalPath = "localPathTest", TfsProjectCollection = "CorporateSites", WorkspaceName = "TestWorkspaceName" }; workspaceInfos.Add(tfsInfo); var tfsInfo1 = new { TfsPath = "tfsTestPath1", LocalPath = "localPathTest1", TfsProjectCollection = "CorporateSites1", WorkspaceName = "TestWorkspaceName1" }; workspaceInfos.Add(tfsInfo1); dgvTfsSettings.ItemsSource = workspaceInfos; //dgvProjects.Rows[0].Cells[0].Value = @"D:\AutomationTestAssistant\TestTime\TestTime.csproj"; }
/// Liste der Rollen initialisieren #region Roles public List<string> InitializeRoles() { List<string> rollen = new List<string>(); rollen.Add("user"); rollen.Add("admin"); return rollen; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var htmlText = value as string; if (string.IsNullOrWhiteSpace(htmlText)) return value; var splits = Regex.Split(htmlText, "<a "); var result = new List<Inline>(); foreach (var split in splits) { if (!split.StartsWith("href=\"")) { result.AddRange(FormatText(split)); continue; } var match = Regex.Match(split, "^href=\"(?<url>(.+?))\" class=\".+?\">(?<text>(.*?))</a>(?<content>(.*?))$", RegexOptions.Singleline); if (!match.Success) { result.Add(new Run(split)); continue; } var hyperlink = new Hyperlink(new Run(match.Groups["text"].Value)) { NavigateUri = new Uri(match.Groups["url"].Value) }; hyperlink.RequestNavigate += Hyperlink_RequestNavigate; result.Add(hyperlink); result.AddRange(FormatText(match.Groups["content"].Value)); } return result; }
private void PrepareWeekGrid() { for (int i = 0; i < 4; i++)//Creating listviews where we will display Timesatmps for rows { ListView list = new ListView(); //Little bit of tinkering with properties to get desired result; list.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled); Label timelabel = new Label();//We will display timestamp on this label timelabel.Content = TimePeriodToString((timeperiod)i);//setting list.Items.Add(timelabel);//adding label to listview TimeStamps.Children.Add(list);//Adding listview to grid; } Label[] weekDayLabels = new Label[7];//Labels for dispaly weekday name List<DayOfWeek> customday = new List<DayOfWeek>();// reshuffling weekady enum to set monday as first day of week foreach (DayOfWeek day in Enum.GetValues(typeof(DayOfWeek)) .OfType<DayOfWeek>() .ToList()//monday is second day by default .Skip(1))//so we skip sunday { customday.Add(day);//adding } customday.Add(DayOfWeek.Sunday);//and add sunday as last for (int i = 0; i < weekDayLabels.Length; i++)//Placing all the labels at grid; { weekDayLabels[i] = new Label(); weekDayLabels[i].Background = Brushes.LightBlue; weekDayLabels[i].Content = customday.ElementAt(i).ToString();//With appropriate day name;(This will correspond to actual date-weekday) DayLabels.Children.Add(weekDayLabels[i]); } }
public Map() { walls = new List<Wall>(); players = new List<Player>(); tokens = new List<Token>(); Token.tokenNum = 0; Player p1 = new Player(); Player p2 = new Player(); p1.setName(Settings.getInstance().getPlayer1Name()); p2.setName(Settings.getInstance().getPlayer2Name()); players.Add(p1); players.Add(p2); //width = 13; //height = 19; width = (Settings.getInstance().getWidth() * 2) + 1; height = (Settings.getInstance().getHeight() * 2) + 3; board = new String[width+2, height+2]; initializeBoard(); placeTokens(); coverageCheck = new int[width, height]; resetCovereage(); }
public static void SaveCurrentState(AdvancedApplicationBar advancedApplicationBar) { var stateList = new List<BaseButton>(); foreach (var buttonItem in advancedApplicationBar.ButtonItems) { if(buttonItem is AdvancedApplicationBarMenuItem) { var aitem = buttonItem as AdvancedApplicationBarMenuItem; var baseButton = new BaseMenuItemButton() { Text = aitem.Text, IsVisible = aitem.Visibility == Visibility.Visible, IsEnabled = aitem.IsEnabled, }; stateList.Add(baseButton); } if(buttonItem is AdvancedApplicationBarIconButton) { var aitem = buttonItem as AdvancedApplicationBarIconButton; var baseButton = new BaseIconItemButton() { Text = aitem.Text, IsVisible = aitem.Visibility == Visibility.Visible, IsEnabled = aitem.IsEnabled, IconUri=aitem.IconUri }; stateList.Add(baseButton); } } PhoneApplicationService.Current.State[GetButtonKey()] = stateList; PhoneApplicationService.Current.State[GetAppBarKey()] = new ApplicationBarSaveStateItem().SaveState(advancedApplicationBar); }
public FixedDocument Create(IEnumerable<ReportItem> data) { var rows = new List<object>(); foreach (var workItem in data) { switch (workItem.Type) { case "User Story": rows.Add(new ProductBacklogItemCardRow(workItem)); break; case "Task": rows.Add(new TaskCardRow(workItem)); break; case "Bug": rows.Add(new BugCardRow(workItem)); break; default: rows.Add(new UnknownCardRow(workItem)); break; } } return GenerateReport( page => new PageInfo(page, DateTime.Now), PaperSize, Margins, rows ); }
public Export_to_Pdf() { InitializeComponent(); //Create object for pdf. document = new PdfDocument(); page = document.AddPage(); gfx = XGraphics.FromPdfPage(page); //Set by default values. font = new XFont("Arial", 12, XFontStyle.Regular); header_font = new XFont("Arial", 12, XFontStyle.Regular); page.Size = PageSize.A4; page.Orientation = PageOrientation.Portrait; ////////////////////////////////////////////////////////////////////// //Create a fake questionanire to test the print process to pdf. if (questionaire != null) { List<Question> question_list = new List<Question>(); List<Answer> answer_list = new List<Answer>(); Answer ans = new Answer(); ans.Answer_descr = "einai to dsfgdsfgsd"; answer_list.Add(ans); answer_list.Add(ans); answer_list.Add(ans); Question quest = new Question() { AnswerList = answer_list }; quest.Question_descr = "H ekfoonisi tis erotisis aytis einai blablbalbablbalblab"; for (int i = 0; i < 10; i++) { question_list.Add(quest); } questionaire = new Quastionnaire.Model.Questionaire() { Questionaire_descr = "sdfsakdfjdflshsadflkjashflasdfkh", QuestionList = question_list }; } ////////////////////////////////////////////////////////////////////// }
public List<IPrimitiveConditionData> GenerateRules(List<TouchPoint2> points) { List<IPrimitiveConditionData> result = new List<IPrimitiveConditionData>(); bool singlePoint = false; foreach (TouchPoint2 point in points) { singlePoint = TrigonometricCalculationHelper.isASinglePoint(point); if (singlePoint) { result.Add(null); continue; } // A point can't be a closed loop // if it is not a finger, it can't be a closed loop if (!point.isFinger) { result.Add(null); continue; } ValidSetOfPointsCollection valids = Validate(points); if ((valids != null) && (valids.Count > 0)) { _data.State = "true"; result.Add(_data); } } return result; }
// decrypt list of objects for history function public List<object> decrypt(List<object> cipherArr) { List<object> lstObj = new List<object>(); if (cipherArr.Count > 0) { foreach (object o in cipherArr) { if (o.GetType() == typeof(JArray)) { if (((JArray)o).Count > 0) { lstObj.Add(decrypt((JArray)o)); } } else if (o.GetType() == typeof(string)) { if ((string)o !="") { lstObj.Add(decrypt((string)o)); } } else { if (((JObject)o).Count > 0) { lstObj.Add(decrypt((JObject)o)); } } } } return lstObj; }
public UCDiscoverScreen(MainWindow _source) { _main = _source; InitializeComponent(); CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); List<Events> decEvents1 = new List<Events>(); decEvents1.Add(new Events("Inside", "Inside is a play about modern life. Daniel MacIvor adapted the play with University of Calgary students", "Images/inside.jpg", "210 University Ct. N.W\nReeve Theatre", "Tuesday 7:30 p.m\nWednesday 7:30 p.m\nThursday 7:30 p.m\nFriday 7:30 p.m\nSaturday 7:30 p.m\nSunday 2 p.m")); decEvents1.Add(new Events("Jewish Book Festival", "Browse hundreds of books at the annual Jewish Book Festival", "Images/jewish_book_event.jpeg", "1607 90 Ave. S.W\nJewish Centre Calgary", "Sunday 10 a.m. to 8:30 p.m\nMonday 10 a.m.to 8:30 p.m\nTuesday 10 a.m.to 8:30 p.m\nWednesday 10 a.m.to 8:30 p.m\nThursday 10 a.m.to 8:30 p.m\nFriday 10 a.m.to 4 p.m\nSaturday 6 p.m.to 8:30 p.m.")); eventListing = new Dictionary<String, List<Events>>(); eventListing.Add("12/1/2015", decEvents1); eventListing.Add("12/2/2015", decEvents1); eventListing.Add("12/3/2015", decEvents1); eventListing.Add("12/4/2015", decEvents1); eventListing.Add("12/5/2015", decEvents1); List <Events> novEvents = new List<Events>(); novEvents.Add(new Events("Calgary Flames", "Calgary flames face off against the league leading team Chicago Blackhawks", "Images/Calgary-Flames.jpg", "555 Saddledome Rise SE\n T2G 2W1", "Saturday 7 p.m - 10 p.m")); novEvents.Add(new Events("Illuminasia", "Exotic lantern festival from different parts of asia", "Images/illuminasia.jpg", "1300 Zoo Rd NE\nT2E 7V6", "All week 7 pm")); novEvents.Add(new Events("Calgary Stampede", "Famous cowboy festival for all ages", "Images/stampede_logo.png", "1410 Olympic Way SE\nT2G 2W1", "7 a.m. to 12 p.m")); eventListing.Add("11/25/2015", novEvents); expAttractions.IsExpanded = true; setupCalendar(); }
private void buttonClick(object sender, RoutedEventArgs e) { string[] info = ((Button)sender).Uid.Split(new string[] {","}, StringSplitOptions.RemoveEmptyEntries); List<armCommand> commands = new List<armCommand>(); foreach (string potentialCommand in info) { double val; if (double.TryParse(potentialCommand.Substring(potentialCommand.LastIndexOf(":") + 1) , out val)) { if (potentialCommand.StartsWith("SH:")) { commands.Add(new armCommand(val, armConstants.armActuatorID.shoulder)); } else if (potentialCommand.StartsWith("G:")) { commands.Add(new armCommand(val, armConstants.armActuatorID.grip)); } else if (potentialCommand.StartsWith("E:")) { commands.Add(new armCommand(val, armConstants.armActuatorID.elbow)); } else if (potentialCommand.StartsWith("TT:")) { commands.Add(new armCommand(val, armConstants.armActuatorID.turnTable)); } } } if (commands.Count > 0 && newMacroData != null) { newMacroData(commands.ToArray()); } }
public FixedDocument Create(IEnumerable<ReportItem> data) { var rows = new List<object>(); foreach (var workItem in data) { if (workItem.Type == "Product Backlog Item") { rows.Add(new ProductBacklogItemCardRow(workItem)); } else if (workItem.Type == "Task") { rows.Add(new TaskCardRow(workItem)); } else if (workItem.Type == "Bug") { rows.Add(new BugCardRow(workItem)); } else if (workItem.Type == "Impediment") { rows.Add(new ImpedimentCardRow(workItem)); } else { rows.Add(new UnknownCardRow(workItem)); } } return GenerateReport( page => new PageInfo(page, DateTime.Now), PaperSize, Margins, rows ); }
public List<IPrimitiveConditionData> GenerateRules(List<TouchPoint2> points) { List<IPrimitiveConditionData> rules = new List<IPrimitiveConditionData>(); if (points.Count == 1) { _data.Min = 1; rules.Add(_data); return rules; } int touchCount = 1; for (int i = 1; i < points.Count; i++) { if ((points[i].TouchDeviceId != points[i - 1].TouchDeviceId) && points[i].StartTime < points[i-1].EndTime) // this makes sure that the second point starts before the previous finishes { touchCount++; } } _data.Min = touchCount; rules.Add(_data); if (rules.Count > 0) return rules; else return null; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { List<Inline> inlines = new List<Inline>(); if (value != null && !string.IsNullOrEmpty(value.ToString())) { Vehicle inputVehicle; Driver inputDriver; if (value is Vehicle) { inputVehicle = (Vehicle)value; inlines.Add(new Run(inputVehicle.Name + " ")); _CreateListOfSpecialties(inlines, inputVehicle); } else if (value is Driver) { inputDriver = (Driver)value; inlines.Add(new Run(inputDriver.Name + " ")); _CreateListOfSpecialties(inlines, inputDriver); } } return inlines; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Debug.Assert(value is HistoryService.HistoryItem); Debug.Assert(targetType.Equals(typeof(ICollection<Inline>))); Debug.Assert(value != null); HistoryService.HistoryItem item = (HistoryService.HistoryItem)value; List<Inline> inlines = new List<Inline>(); int startIndex = 0; int nextIndex = 0; do { nextIndex = item.String.IndexOf(item.Substring, startIndex, StringComparison.InvariantCultureIgnoreCase); if (nextIndex == -1) // add remaining ordinary text inlines.Add(new Run(item.String.Substring(startIndex))); else { if (nextIndex != startIndex) // add ordinal text inlines.Add(new Run(item.String.Substring(startIndex, nextIndex - startIndex))); inlines.Add(new Bold(new Underline(new Run(item.String.Substring(nextIndex, item.Substring.Length))))); startIndex = nextIndex + item.Substring.Length; } } while (nextIndex != -1); return inlines; }
public List<IPrimitiveConditionData> GenerateRules(List<TouchPoint2> points) { // Paths generally contain a lot of points, we are skipping some points // to improve performance. The 'step' variable decides how much we should skip List<IPrimitiveConditionData> primitives = new List<IPrimitiveConditionData>(); bool singlePoint = false; foreach (TouchPoint2 point in points) { if (!point.isFinger) { primitives.Add(null); continue; } singlePoint = TrigonometricCalculationHelper.isASinglePoint(point); if (singlePoint) { primitives.Add(null); continue; } StylusPoint p1 = point.Stroke.StylusPoints[0]; StylusPoint p2 = point.Stroke.StylusPoints[point.Stroke.StylusPoints.Count - 1]; double slope = TrigonometricCalculationHelper.GetSlopeBetweenPoints(p1, p2); string sDirection = TouchPointExtensions.SlopeToDirection(slope); TouchDirection direction = new TouchDirection(); direction.Values = sDirection; primitives.Add(direction); } return primitives; }
private void SetCombo() { var machineTypeSource = (new CollectionHelper()).GetUndeclaredCollection(false, _IsPartDeclaration); var enumerator = new List<UndeclaredCollection>(); var variable = new UndeclaredCollection { Collection_Batch_Name = "", Collection_Batch_No = -1, DisplayName = FindResource("PleaseSelectbatch") as string }; enumerator.Add(variable); variable = new UndeclaredCollection { Collection_Batch_Name = "", Collection_Batch_No = 0, DisplayName = FindResource("PartCollections") as string }; enumerator.Add(variable); foreach (var undeclaredCollection in machineTypeSource) enumerator.Add(undeclaredCollection); cboBatch.ItemsSource = enumerator; if (enumerator.Count > 2) cboBatch.SelectedIndex = 2; }
public MainWindow() { InitializeComponent(); Pacjent pac1 = new Pacjent(); List <Pacjent> lista_pac = new List<Pacjent>(); lista_pac.Add(pac1); pac1 = new Pacjent() { Nazwisko = "Chopin", Imie= "Fryderyk", Adres= "Paryz 123/18", Nr_tel= 33333333 , Stawka= 10 }; lista_pac.Add(pac1); using (XmlWriter xw = XmlWriter.Create("newxml1.xml")) { xw.WriteStartDocument(); xw.WriteStartElement("lista_pac"); foreach (Pacjent pacjent in lista_pac) { xw.WriteStartElement("pacjent"); xw.WriteElementString("nazwisko", pacjent.Nazwisko); xw.WriteElementString("imie", pacjent.Imie); xw.WriteElementString("adres", pacjent.Adres); xw.WriteElementString("telefon", pacjent.Nr_tel.ToString()); xw.WriteElementString("stawka", pacjent.Stawka.ToString()); xw.WriteEndElement(); } xw.WriteEndElement(); xw.WriteEndDocument(); } }
private void OnLoaded(object sender, object e) { PropertyInfo[] props = typeof(Brushes).GetProperties(); List<object> data = new List<object>(17); data.Add(new UI()); SampleImageHelper.GetPicturePaths().Take(8).ForEach(path => data.Add(new Picture(path))); for (int i = 0; i < Math.Min(props.Length, 8); i++) { if (props[i].Name != "Transparent") { data.Add(new Swatch(props[i].Name)); } } this.DataContext = _data.ItemsSource = data; // Setup 2 way transitions Transition[] transitions = (Transition[])FindResource("ForwardBackTransitions"); for (int i = 0; i < transitions.Length; i += 2) { ListTransitionSelector selector = new ListTransitionSelector(transitions[i], transitions[i + 1], data); TextSearch.SetText(selector, TextSearch.GetText(transitions[i])); _selectors.Items.Add(selector); } }
/****************************************************** * Purpose: Get the pages in each of the lessons * Usage: Folder must be in format: Lesson# * Pages must be in format: Page# ******************************************************/ public static List<Page> GetPagesInLesson(int lesson) { List<Page> pages = new List<Page>(); Assembly asm = Assembly.GetExecutingAssembly(); string name_space = "CodeLingo.Lesson" + lesson.ToString(); foreach (Type type in asm.GetTypes()) { if (type.Namespace == name_space) { string n = type.Namespace + "." + type.Name; if (type.Name.Length < 6) { Page p = asm.CreateInstance(n, true) as Page; pages.Add(p); } } } //this loop is here because Page10+will be out of order because VS doesn't know that 9 < 10 -_- foreach (Type type in asm.GetTypes()) { if (type.Namespace == name_space) { string n = type.Namespace + "." + type.Name; if (type.Name.Length == 6) { Page p = asm.CreateInstance(n, true) as Page; pages.Add(p); } } } return pages; }
private void AddRunOnForms() { /* Update the UI Grid to fit everything */ for (int i = 0; i < 2; i++) { RowDefinition rowDef = new RowDefinition(); rowDef.Height = System.Windows.GridLength.Auto; ParametersGrid.RowDefinitions.Add(rowDef); } Grid.SetRow(ButtonsPanel, ParametersGrid.RowDefinitions.Count - 1); Label runOnLabel = new Label(); runOnLabel.Content = "Choose where to run the test job:"; Grid.SetRow(runOnLabel, ParametersGrid.RowDefinitions.Count - 3); Grid.SetColumn(runOnLabel, 0); Grid.SetColumnSpan(runOnLabel, 2); IList<string> runOnOptions = new List<string>(); runOnOptions.Add("Azure"); foreach (HybridRunbookWorkerGroup group in this.hybridGroups) { runOnOptions.Add(group.Name); } ComboBox runOnComboBox = new ComboBox(); runOnComboBox.ItemsSource = runOnOptions; runOnComboBox.SelectedIndex = 0; runOnComboBox.SelectionChanged += changeRunOnSelection; Grid.SetRow(runOnComboBox, ParametersGrid.RowDefinitions.Count - 2); Grid.SetColumn(runOnComboBox, 0); Grid.SetColumnSpan(runOnComboBox, 2); /* Add to Grid */ ParametersGrid.Children.Add(runOnLabel); ParametersGrid.Children.Add(runOnComboBox); }
public SyncedTrackBalls() { InitializeComponent(); List<List<PlotInfo>> list = new List<List<PlotInfo>>(); list.Add(new List<PlotInfo> { new PlotInfo { Date = new DateTime(2013, 11, 21), YVal = 40, }, new PlotInfo { Date = new DateTime(2013, 11, 22), YVal = 50, }, new PlotInfo { Date = new DateTime(2013, 11, 23), YVal = 90, }, new PlotInfo { Date = new DateTime(2013, 11, 24), YVal = 90, }, new PlotInfo { Date = new DateTime(2013, 11, 25), YVal = 40, }, new PlotInfo { Date = new DateTime(2013, 11, 26), YVal = 30, }, new PlotInfo { Date = new DateTime(2013, 11, 27), YVal = 40, }, new PlotInfo { Date = new DateTime(2013, 11, 28), YVal = 40, }, }); list.Add(new List<PlotInfo> { new PlotInfo { Date = new DateTime(2013, 11, 23), YVal = 1100, }, new PlotInfo { Date = new DateTime(2013, 11, 24), YVal = 1100, }, new PlotInfo { Date = new DateTime(2013, 11, 25), YVal = 1200, }, new PlotInfo { Date = new DateTime(2013, 11, 26), YVal = 1000, }, new PlotInfo { Date = new DateTime(2013, 11, 27), YVal = 700, }, new PlotInfo { Date = new DateTime(2013, 11, 28), YVal = 900, }, new PlotInfo { Date = new DateTime(2013, 11, 29), YVal = 500, }, new PlotInfo { Date = new DateTime(2013, 11, 30), YVal = 800, }, }); this.DataContext = list; }
public ConditionSettings(ConnectionXML conn) { InitializeComponent(); this.connection = conn; //this.connection.Type = ConnectionTypes.eCondition; if (this.connection.Condition == null) { this.connection.Condition = new GameClasses.Condition(); this.connection.Condition.Predicates = new List<Predicate>(); } else { this.txtText.Text = this.connection.Condition.Text; } this.dgPredicates.ItemsSource = this.connection.Condition.Predicates; var lstItems = new List<ItemStrings>(); lstItems.AddRange(Globals.GameElements.Items); lstItems.AddRange(Globals.GameElements.Stats); lstItems.AddRange(Globals.GameElements.Skills); this.dgcmbPredicateName.ItemsSource = lstItems; List<PredicateTypeList> Dict = new List<PredicateTypeList>(); Dict.Add(new PredicateTypeList{ Key = PredicateTypes.eInventory, Value = "Inventory"}); Dict.Add(new PredicateTypeList { Key = PredicateTypes.eStat, Value = "Stat"}); Dict.Add(new PredicateTypeList{ Key = PredicateTypes.eSkill, Value = "Skill"}); this.dgcmbPredicateType.ItemsSource = Dict; }
private void InitializeStatusList() { _status = new List<string>(); _status.Add("AKTYWNA"); _status.Add("NIEAKTYWNA"); _comboboxStatus.ItemsSource = _status; }
/// <summary> /// Highlights words in the exmaple DecoratortextBox. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The key event arguments</param> private void ExampleDecoratorTextBox_EnterPressed(object sender, KeyEventArgs e) { List<HighlightSection> terms = new List<HighlightSection>(); string[] words = this.ExampleDecoratorTextBox.Text.Split(' '); int wordTicker = 0; int charPosition = 0; for (int i = 1; i <= words.Length; i++) { wordTicker = wordTicker >= 4 == true ? 1 : wordTicker + 1; HighlightSection t; if (wordTicker == 1) { t = new HighlightSection(charPosition, true, words[i - 1].Length); terms.Add(t); } else if (wordTicker == 3) { t = new HighlightSection(charPosition, false, words[i - 1].Length); terms.Add(t); } charPosition = charPosition + words[i - 1].Length + 1; } this.ExampleDecoratorTextBox.MatchingTermItemsSource = terms; }
/// <summary> /// 保存单据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void EditForm_Saving(object sender, SavingEventArgs e) { List<string> msgs = new List<string>(); T_FB_SUMSETTINGSMASTER entCurr = this.OrderEntity.Entity as T_FB_SUMSETTINGSMASTER; entCurr.CHECKSTATES = 0; entCurr.EDITSTATES = 1; if (string.IsNullOrWhiteSpace(entCurr.OWNERID) || string.IsNullOrWhiteSpace(entCurr.OWNERNAME)) { msgs.Add("汇总人不能为空"); e.Action = Actions.Cancel; CommonFunction.ShowErrorMessage(msgs); return; } ObservableCollection<FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_SUMSETTINGSDETAIL).Name); ObservableCollection<FBEntity> list0 = new ObservableCollection<FBEntity>(); //明细为为0的不能提交 if (details.ToList().Count <= 1) { msgs.Add("预算汇总设置中添加的公司至少超过一家"); } if (msgs.Count > 0) { e.Action = Actions.Cancel; CommonFunction.ShowErrorMessage(msgs); } }
//private DatabaseModel.Database<Mission> ListOfMissions = new DatabaseModel.Database<Mission>("ToDoList.txt"); // Instead the above we need to call the parent window public CreateTaskWindow(DateTime taskDate, Mission editMission = null) { InitializeComponent(); this.taskDate = taskDate; this.editMission = editMission; // this.missionFileControler = new MissionFileControler(); List<PriorityLevel> priorityLevels = new List<PriorityLevel>(); priorityLevels.Add(PriorityLevel.Low); priorityLevels.Add(PriorityLevel.Medium); priorityLevels.Add(PriorityLevel.Urgent); this.ComboBoxPriority.ItemsSource = priorityLevels; // set default value if (this.editMission == null) { this.ComboBoxPriority.SelectedValue = priorityLevels[0]; } else { this.Title = "Edit task"; this.ComboBoxPriority.SelectedValue = this.editMission.Priority; this.TextBoxName.Text = this.editMission.Name; this.TextBoxDescription.Text = this.editMission.Description; this.addButton.Content = "Update"; } }
public EditAlat(Alat alat) { InitializeComponent(); this.alat = alat; status = new List<KV>(); status.Add(new KV("Baik", 1)); status.Add(new KV("Rusak", 0)); comboBox_Status.ItemsSource = status; comboBox_Status.DisplayMemberPath = "Key"; comboBox_Status.SelectedValuePath = "Value"; comboBox_Status.SelectedValue = (alat.KondisiAlat) ? 1 : 0; textbox_Laboratorium.Text = alat.Lokasi; string query = "SELECT * FROM master_inventory_type"; using (MySqlCommand cmd = new MySqlCommand(query, db.ConnectionManager.Connection)) { try { DataTable dataSet = new DataTable(); using (MySqlDataAdapter dataAdapter = new MySqlDataAdapter(cmd)) { dataAdapter.Fill(dataSet); comboBox_Jenis_Barang.ItemsSource = dataSet.DefaultView; comboBox_Jenis_Barang.DisplayMemberPath = dataSet.Columns["nama"].ToString(); comboBox_Jenis_Barang.SelectedValuePath = dataSet.Columns["id"].ToString(); comboBox_Jenis_Barang.SelectedValue = alat.IdJenis; } } catch (MySql.Data.MySqlClient.MySqlException ex) { MessageBox.Show(ex.Message); } } }
public object DisplayData(object rawData) { var raw = (List<ActivitySet>)rawData; List<Run> displayString = new List<Run>(); try { if (raw != null && raw.Count > 0) { displayString.Add(new Run { Text = " Details... ", Foreground = new SolidColorBrush(Colors.Black), FontSize = 12 }); } else { displayString.Add(new Run { Text = " Not Linked ", Foreground = new SolidColorBrush(Colors.Red), FontSize = 12 }); } } catch (Exception) { } return displayString; }