void Start() { // Set up our fullscreen toggle button if (GameObject.Find("FullscreenToggle") != null) { fullscreen = GameObject.Find("FullscreenToggle").GetComponent<Toggle>(); if (Screen.fullScreen) fullscreen.isOn = true; else fullscreen.isOn = false; } // Set up our resolution dropdown box if (GameObject.Find("ResolutionList") != null) { resolutions = GameObject.Find("ResolutionList").GetComponent<ComboBox>(); ComboBoxItem[] items = new ComboBoxItem[Screen.resolutions.Length]; int counter = 0; Resolution[] res = Screen.resolutions; foreach (Resolution r in res) { items[counter] = new ComboBoxItem(r); counter++; } resolutions.Items = items; resolutions.ItemsToDisplay = 5; Resolution tmpRes = Screen.currentResolution; foreach (Resolution r in Screen.resolutions) { if (Screen.width == r.width && Screen.height == r.height) { tmpRes = r; break; } } resolutions.SelectedIndex = System.Array.IndexOf(Screen.resolutions, tmpRes); } }
//------------------------------------------------------------------------------------- #region << Form Handlers >> private void SimDataGridViewFindForm_Shown(object sender, EventArgs e) { try { ComboBoxItem<int> selCol = null; int cur = -1; if(preferedColumnIndex != -1) cur = preferedColumnIndex; else if(view.CurrentCell != null) cur = view.CurrentCell.ColumnIndex; foreach(DataGridViewColumn col in view.Columns) { if(col.Visible == false) continue; ComboBoxItem<int> i = new ComboBoxItem<int>(col.Index, col.HeaderText); comboBoxColumns.Items.Add(i); if(col.Index == cur) selCol = i; } if(selCol != null) comboBoxColumns.SelectedItem = selCol; else comboBoxColumns.SelectFirstDropDownItem(); } catch(Exception Err) { ErrorBox.Show(Err); } }
private void MainForm_Load(object sender, EventArgs e) { cboInstallationTypes.Items.Clear(); cboInstallationTypes.DisplayMember = "Text"; cboInstallationTypes.ValueMember = "Value"; var configInterfaces = ConfigApplicationFactory.AvailableInterfaces; foreach (var configInterface in configInterfaces) { ComboBoxItem<string> cbItem = new ComboBoxItem<string>() { Text = configInterface.Value, Value = configInterface.Key }; cboInstallationTypes.Items.Add(cbItem); } BMCInstallationType installationType = BMCRegistryHelper.InstallationType; string mapName = _mappings[installationType]; var item = (from a in cboInstallationTypes.Items.OfType<ComboBoxItem<string>>() where a.Value.IgnoreCaseCompare(mapName) select a).FirstOrDefault(); if (item != null) { cboInstallationTypes.SelectedItem = item; } else { cboInstallationTypes.SelectedIndex = 0; } }
public RequestDelivery(ClientController clientCon, ClientState clientState) { InitializeComponent(); var state = new CurrentState(); var routeService = new RouteService(state); _pathFinder = new PathFinder(routeService); _clientState = clientState; _pathfindService = new DeliveryService(state, _pathFinder); _clientController = clientCon; foreach (var routeNode in clientState.GetAllRouteNodes()) { ComboBoxItem cbi = new ComboBoxItem(); if (routeNode is DistributionCentre) cbi.Content = ((DistributionCentre)routeNode).Name; else if (routeNode is InternationalPort) cbi.Content = routeNode.Country.Name; cbi.Tag = routeNode.ID; this.origin.Items.Add(cbi); ComboBoxItem cbi2 = new ComboBoxItem(); if (routeNode is DistributionCentre) cbi2.Content = ((DistributionCentre)routeNode).Name; else if (routeNode is InternationalPort) cbi2.Content = routeNode.Country.Name; cbi2.Tag = routeNode.ID; this.destination.Items.Add(cbi2); } _clientController.OptionsReceived += new ClientController.DeliveryOptionsDelegate(DeliveryOptions_Returned); _clientController.DeliveryOK+= new ClientController.DeliveryConfirmedDelegate(DeliveryConfirmed); }
public void Add(OldConfiguration.Language language) { ComboBoxItem c = new ComboBoxItem(); c.Content = language.Resource["LangCode"] as String; Items.Add(c); }
protected void Page_Load(object sender, EventArgs e) { ComboBox1 = new ComboBox(); ComboBox1.ID = "ComboBox1"; ComboBoxItem item1 = new ComboBoxItem(); item1.Text = "Item 1"; item1.Value = "1"; ComboBox1.Items.Add(item1); ComboBoxItem item2 = new ComboBoxItem(); item2.Text = "Item 2"; item2.Value = "2"; ComboBox1.Items.Add(item2); ComboBoxItem item3 = new ComboBoxItem(); item3.Text = "Item 3"; item3.Value = "3"; ComboBox1.Items.Add(item3); ComboBoxItem item4 = new ComboBoxItem(); item4.Text = "Item 4"; item4.Value = "4"; ComboBox1.Items.Add(item4); ComboBoxItem item5 = new ComboBoxItem(); item5.Text = "Item 5"; item5.Value = "5"; ComboBox1.Items.Add(item5); ComboBox1Container.Controls.Add(ComboBox1); }
void OnColorPickerMouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { ColorDialog cd = new ColorDialog(); DialogResult r = cd.ShowDialog(); if (r == DialogResult.OK) { int index = 0; Color c = cd.Color; index = _colorPicker.Items.IndexOf("OTHER"); if (index == -1) { ComboBoxItem item = new ComboBoxItem(); item.Text = "OTHER"; item.Value = c.ToArgb(); _colorPicker.Items.Insert(0, item); index = 0; } _colorPicker.SelectedItem = _colorPicker.Items[index]; //c.Name // _colorPicker.Select(index, 1); } } }
public MainWindow() { InitializeComponent(); list.DataContext = mRules.Rules; ComboBoxItem cboxitem1 = new ComboBoxItem(); cboxitem1.Content = "MoveTo"; comboBox1.Items.Add(cboxitem1); ComboBoxItem cboxitem2 = new ComboBoxItem(); cboxitem2.Content = "UseItem"; comboBox1.Items.Add(cboxitem2); ComboBoxItem cboxitem3 = new ComboBoxItem(); cboxitem3.Content = "RayCastQuery"; comboBox2.Items.Add(cboxitem3); ComboBoxItem cboxitem4 = new ComboBoxItem(); cboxitem4.Content = "GetByID"; comboBox2.Items.Add(cboxitem4); ComboBoxItem cboxitem5 = new ComboBoxItem(); cboxitem5.Content = "AABBQuery"; comboBox2.Items.Add(cboxitem5); ComboBoxItem cboxitem6 = new ComboBoxItem(); cboxitem6.Content = "RadiusQuery"; comboBox2.Items.Add(cboxitem6); list.DataContext = mRules; }
public SledTtyGui() { InitializeComponent(); var none = new ComboBoxItem(null); m_cmbLanguages.Items.Add(none); m_cmbLanguages.SelectedItem = none; }
public SelectionWindow(MainWindow window, int offset) { InitializeComponent(); mWindow = window; mOffset = offset; XmlTextReader reader = new XmlTextReader("../../Content/Types.xml"); items = new Hashtable(); hasText = new Hashtable(); StackPanel stack = new StackPanel(); cbox = new ComboBox(); cbox.Background = Brushes.LightBlue; reader.Read(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: var cboxitem = new ComboBoxItem(); cboxitem.Content = reader.Name; cbox.Items.Add(cboxitem); name = reader.Name; //hasText[name] = false; List<Tuple<string, string>> list = new List<Tuple<string, string>>(); items[name] = list; if (reader.HasAttributes) { List<Tuple<string, string>> templist = items[name] as List<Tuple<string, string>>; while (reader.MoveToNextAttribute()) { Tuple<string, string> tuple = new Tuple<string, string>(reader.Name, reader.Value); templist.Add(tuple); } } break; case XmlNodeType.Text: hasText[name] = reader.Value; break; case XmlNodeType.EndElement: break; } } stack.Children.Add(cbox); Button AddButton = new Button(); AddButton.Content = "Add"; AddButton.Click += AddButton_Click; stack.Children.Add(AddButton); this.AddChild(stack); }
private void LoadUiLanguages() { ddlUILanguage.Items.Clear(); foreach (var lang in LocalizationManager.GetUILanguages(true)) { var item = new ComboBoxItem(lang.Name, lang.NativeName); ddlUILanguage.Items.Add(item); } ddlUILanguage.SelectedItem = ddlUILanguage.Items.OfType<ComboBoxItem>().SingleOrDefault(s => s.Value == _uiLanguage); }
public void AddItem(ComboBoxItem obj) { if (this.InvokeRequired) { AddComboBoxItem_ dlgt = new AddComboBoxItem_(AddItem); Invoke(dlgt, new object[] { obj }); } else { this.Items.Add(obj); } }
public static void AddItemIfNotExists(this DataGridViewComboBoxCell pComboBoxCell, ComboBoxItem pItem) { if (pComboBoxCell != null && pItem != null && pComboBoxCell.DataSource == null && !pComboBoxCell.HasItem(pItem)) { Debug.WriteLine("verdi added: " + pItem.value); pComboBoxCell.Items.Add(pItem); pComboBoxCell.DisplayMember = "key"; pComboBoxCell.ValueMember = "value"; pComboBoxCell.Value = pItem.key; } return; }
private void LoadFileList() { var dir = Path.Combine(Environment.CurrentDirectory, "CutFile"); var files = Directory.GetFiles(dir).ToList(); files.ForEach(f => { var fi = new FileInfo(f); var selectItem = new ComboBoxItem() { Text = fi.Name.Split('.')[0], Value = fi.FullName }; LoadBox.Items.Add(selectItem); }); }
private void LoadColors() { foreach (System.Reflection.PropertyInfo prop in typeof(Color).GetProperties()) { if (prop.PropertyType.FullName == "System.Drawing.Color") { ComboBoxItem item = new ComboBoxItem(); item.Text = prop.Name; item.Value = (Color.FromName(prop.Name)).ToArgb(); _colorPicker.Items.Add(item); } _colorPicker.SelectedItem = _colorPicker.Items[0]; } }
private void Start() { var itemMakeBig = new ComboBoxItem("Make me big!"); var itemMakeNormal = new ComboBoxItem("Normal", image, true); var itemMakeSmall = new ComboBoxItem("Make me small!"); itemMakeBig.OnSelect += () => { comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 180); comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 40); comboBox.UpdateGraphics(); itemMakeBig.Caption = "Big"; itemMakeBig.IsDisabled = true; itemMakeNormal.Caption = "Make me normal!"; itemMakeNormal.IsDisabled = false; itemMakeSmall.Caption = "Make me small!"; itemMakeSmall.IsDisabled = false; }; itemMakeNormal.OnSelect += () => { comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 160); comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 30); comboBox.UpdateGraphics(); itemMakeBig.Caption = "Make me big!"; itemMakeBig.IsDisabled = false; itemMakeNormal.Caption = "Normal"; itemMakeNormal.IsDisabled = true; itemMakeSmall.Caption = "Make me small!"; itemMakeSmall.IsDisabled = false; }; itemMakeSmall.OnSelect += () => { comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 160); comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 20); comboBox.UpdateGraphics(); itemMakeBig.Caption = "Make me big!"; itemMakeBig.IsDisabled = false; itemMakeNormal.Caption = "Make me normal!"; itemMakeNormal.IsDisabled = false; itemMakeSmall.Caption = "Small"; itemMakeSmall.IsDisabled = true; }; comboBox.AddItems(itemMakeBig, itemMakeNormal, itemMakeSmall); comboBox.SelectedIndex = 1; comboBox.OnSelectionChanged += (int index) => { Camera.main.backgroundColor = new Color32((byte)Random.Range(0, 256), (byte)Random.Range(0, 256), (byte)Random.Range(0, 256), 255); }; }
protected void SuperForm1_DataBound(object sender, EventArgs e) { if (SuperForm1.CurrentMode == DetailsViewMode.Edit) { string selectedCountry = DataBinder.Eval(SuperForm1.DataItem, "ShipCountry").ToString(); ComboBox ShipCountryComboBox = (ComboBox)((DetailsViewRow)SuperForm1.Rows[4]).FindControl("ShipCountry"); // Creating an new item using the selected country and marking it as selected ComboBoxItem item = new ComboBoxItem(); item.Value = selectedCountry; item.Text = selectedCountry; item.Selected = true; ShipCountryComboBox.Items.Add(item); ShipCountryComboBox.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { ComboBox1 = new ComboBox(); ComboBox1.ID = "ComboBox1"; ComboBox1.Width = Unit.Pixel(200); ComboBox1.Height = Unit.Pixel(200); ComboBox1.EnableLoadOnDemand = true; ComboBox1.OpenOnFocus = true; ComboBox1.EmptyText = "Search for country ..."; ComboBox1.DataTextField = "CountryName"; ComboBox1.DataValueField = "CountryID"; ComboBox1.LoadingItems += ComboBox1_LoadingItems; ComboBoxItem item1 = new ComboBoxItem(); item1.Text = "E"; item1.Value = "E"; item1.Selected = true; ComboBox1.Items.Add(item1); ComboBox1Container.Controls.Add(ComboBox1); }
/// <summary> /// On Monobehaviour Start, configure the items in the combobox and their effects when selected. /// </summary> public void Start() { ComboBoxItem oneHourItem = new ComboBoxItem("1 uur"); ComboBoxItem twoHourItem = new ComboBoxItem("2 uur"); ComboBoxItem threeHourItem = new ComboBoxItem("3 uur!"); oneHourItem.OnSelect += () => { missionMaker.missionDuration = 1; }; twoHourItem.OnSelect += () => { missionMaker.missionDuration = 2; }; threeHourItem.OnSelect += () => { missionMaker.missionDuration = 3; }; comboBox.AddItems(oneHourItem, twoHourItem, threeHourItem); comboBox.SelectedIndex = 0; comboBox.ItemsToDisplay = 3; }
protected void Page_Load(object sender, EventArgs e) { ComboBox1 = new ComboBox(); ComboBox1.ID = "ComboBox1"; ComboBox1.Width = Unit.Pixel(200); ComboBox1.MenuWidth = Unit.Pixel(570); ComboBox1.AutoClose = false; ComboBox1.AllowCustomText = true; ComboBox1.AutoValidate = true; ComboBox1.AllowEdit = false; ComboBox1.EmptyText = "Select a customer ..."; ComboBox1.ClientSideEvents.OnOpen = "ComboBox1_Open"; ComboBoxItem item1 = new ComboBoxItem(); item1.ID = "ComboBoxItem1"; ComboBox1.Items.Add(item1); ComboBox1.ItemTemplate = new ItemTemplate(); ComboBox1Container.Controls.Add(ComboBox1); }
public AddPriceDialogBox(ClientState clientState, bool domestic) { InitializeComponent(); var locationService = new LocationService(clientState); foreach (var routeNode in clientState.GetAllRouteNodes()) { var cbi = new ComboBoxItem(); if (routeNode is DistributionCentre) cbi.Content = ((DistributionCentre)routeNode).Name; else if (routeNode is InternationalPort && !domestic) cbi.Content = routeNode.Country.Name; cbi.Tag = routeNode.ID; this.origin.Items.Add(cbi); var cbi2 = new ComboBoxItem(); if (routeNode is DistributionCentre ) cbi2.Content = ((DistributionCentre)routeNode).Name; else if (routeNode is InternationalPort && !domestic) cbi2.Content = routeNode.Country.Name; cbi2.Tag = routeNode.ID; this.dest.Items.Add(cbi2); } }
public AddRouteDialogBox(ClientState clientState) { InitializeComponent(); //this.comboBox1.ItemsSource = clientState.GetAllRouteNodes(); timesGrid.Columns.Add(new DataGridTextColumn { Header = "Day", Binding = new Binding("Day") }); timesGrid.Columns.Add(new DataGridTextColumn { Header = "Hour", Binding = new Binding("Hour") }); timesGrid.Columns.Add(new DataGridTextColumn { Header = "Minute", Binding = new Binding("Minute") }); foreach (var routeNode in clientState.GetAllRouteNodes()) { ComboBoxItem cbi = new ComboBoxItem(); if (routeNode is DistributionCentre) cbi.Content = ((DistributionCentre)routeNode).Name; else if (routeNode is InternationalPort) cbi.Content = routeNode.Country.Name; cbi.Tag = routeNode.ID; this.originComboBox.Items.Add(cbi); ComboBoxItem cbi2 = new ComboBoxItem(); if (routeNode is DistributionCentre) cbi2.Content = ((DistributionCentre)routeNode).Name; else if (routeNode is InternationalPort) cbi2.Content = routeNode.Country.Name; cbi2.Tag = routeNode.ID; this.destComboBox.Items.Add(cbi2); } foreach (var company in clientState.GetAllCompanies()) { ComboBoxItem cbi = new ComboBoxItem(); cbi.Content = company.Name; cbi.Tag = company.ID; this.companyComboBox.Items.Add(cbi); } }
private void UpdateContent(object senderx, TextChangedEventArgs ex) { registers = new ObservableCollection<RegisterItem>(); registers_final = new ObservableCollection<RegisterItem>(); ComboBoxItem ci = (ComboBoxItem)ItemsPerPage.SelectedItem; int itemsPerPage = Convert.ToInt32(ci.Content); int page = 1; int count = 0; dbman = new DBConnectionManager(); using (conn = new MySqlConnection(dbman.GetConnStr())) { conn.Open(); if (conn.State == ConnectionState.Open) { MySqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM registers WHERE " + "book_number LIKE @query OR " + "book_type LIKE @query OR " + "creation_date LIKE @query OR " + "addition_date LIKE @query OR " + "status LIKE @query;"; cmd.Parameters.AddWithValue("@query", "%" + SearchRegisterBox.Text + "%"); cmd.Prepare(); MySqlDataReader db_reader = cmd.ExecuteReader(); while (db_reader.Read()) { int bookNum = Convert.ToInt32(db_reader.GetString("book_number")); RegisterItem ri = new RegisterItem(); ri.BookTypeHolder.Content = db_reader.GetString("book_type"); ri.BookNoHolder.Content = "Book #" + db_reader.GetString("book_number"); ri.BookContentStatHolder.Content = CountEntries(Convert.ToInt32(db_reader.GetString("book_number"))) + " Entries | " + CountPages(Convert.ToInt32(db_reader.GetString("book_number"))) + " Pages"; ri.ViewRegisterButton.Click += (sender, e) => { ViewRegister_Click(sender, e, bookNum); }; ri.AccessFrequency.Content = "Access Frequency: " + CheckFrequency(bookNum); if (CheckFrequency(bookNum) == "Very Low") { ri.AccessFrequency.Foreground = Brushes.OrangeRed; } else if (CheckFrequency(bookNum) == "Low") { ri.AccessFrequency.Foreground = Brushes.Orange; } else if (CheckFrequency(bookNum) == "Moderate") { ri.AccessFrequency.Foreground = Brushes.ForestGreen; } else if (CheckFrequency(bookNum) == "High") { ri.AccessFrequency.Foreground = Brushes.DeepSkyBlue; } ri.Page.Content = page; registers.Add(ri); count++; if (count == itemsPerPage) { page++; count = 0; } } foreach (var cur in registers) { if (Convert.ToInt32(cur.Page.Content) == CurrentPage.Value) { registers_final.Add(cur); } } //close Connection conn.Close(); RegistersItemContainer.Items.Refresh(); RegistersItemContainer.ItemsSource = registers_final; RegistersItemContainer.Items.Refresh(); CurrentPage.Maximum = page; } else { } } }
private void TypeB_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem temp = (ComboBoxItem)TypeB.SelectedItem; b.Type = (TypeBoutique)Enum.Parse(typeof(TypeBoutique), temp.Content.ToString()); }
private void LoadCatalogs() { //заполнить справочники для выпадающих меню //способы определения поставщика for (int i = 0; i < CCatalog.purchaseMethods.Count; i++) { ComboBoxItem item = new ComboBoxItem(); item.Text = CCatalog.purchaseMethods[i].name; item.Value = i; purchaseMethodID.Items.Add(item); } ////статусы протоколов //for (int i = 0; i < Catalog.protocolStatuses.Count; i++) //{ // ComboBoxItem item = new ComboBoxItem(); // item.Text = Catalog.protocolStatuses[i]; // item.Value = i; // protocolStatusID.Items.Add(item); //} ////ответственный за разработку документации ////foreach (var user in Program.dataManager.GetUserNames()) //{ // ComboBoxItem item = new ComboBoxItem(); // item.Text = user.Value; // item.Value = int.Parse(user.Key); // employeDocumentationID.Items.Add(item); //} ////ответственный за размещение закупки //foreach (var user in Program.dataManager.GetUserNames()) //{ // ComboBoxItem item = new ComboBoxItem(); // item.Text = user.Value; // item.Value = int.Parse(user.Key); // employeID.Items.Add(item); //} ////закон, по которой проводится закупка //for (int i = 0; i < 3; i++) //{ // law.Items.Add(new ComboBoxItem() { Text = Catalog.laws[i], Value = i }); //} ////с АЦК или без неё //withAZK.Items.Add(new ComboBoxItem() { Text = "С АЦК", Value = 0, }); //withAZK.Items.Add(new ComboBoxItem() { Text = "БЕЗ АЦК", Value = 1, }); //purchaseMethodID.MouseWheel += new MouseEventHandler(comboBox_ValueChanged); //statusID.MouseWheel += new MouseEventHandler(comboBox_ValueChanged); //protocolStatusID.MouseWheel += new MouseEventHandler(comboBox_ValueChanged); //employeDocumentationID.MouseWheel += new MouseEventHandler(comboBox_ValueChanged); //employeID.MouseWheel += new MouseEventHandler(comboBox_ValueChanged); //law.MouseWheel += new MouseEventHandler(comboBox_ValueChanged); //withAZK.MouseWheel += new MouseEventHandler(comboBox_ValueChanged); }
private void InitLoggedBeginEndTime() { string LStrRangType = string.Empty; string LStrBegin = string.Empty, LStrEnd = string.Empty; try { UC_DateTime_Begin.IsEnabled = false; UC_DateTime_End.IsEnabled = false; ComboBoxItem RangeTypeItem = CBXLoggedTime.SelectedItem as ComboBoxItem; LStrRangType = RangeTypeItem.Tag.ToString(); if (LStrRangType == "CR") { UC_DateTime_Begin.IsEnabled = true; UC_DateTime_End.IsEnabled = true; IStrBeginTime = LStrBegin + " 00:00:00"; IStrEndTime = LStrBegin + " 23:59:59"; } if (LStrRangType == "TD") { IStrBeginTime = DateTime.Today.ToString("yyyy-MM-dd") + " 00:00:00"; IStrEndTime = DateTime.Today.ToString("yyyy-MM-dd") + " 23:59:59"; } if (LStrRangType == "WK") { CalendarFunctions.GetWeek(ref LStrBegin, ref LStrEnd); IStrBeginTime = LStrBegin + " 00:00:00"; IStrEndTime = LStrEnd + " 23:59:59"; } if (LStrRangType == "TM") { CalendarFunctions.GetThisMonth(ref LStrBegin, ref LStrEnd); IStrBeginTime = LStrBegin + " 00:00:00"; IStrEndTime = LStrEnd + " 23:59:59"; } if (LStrRangType == "LM") { CalendarFunctions.GetPriorMonth(ref LStrBegin, ref LStrEnd); IStrBeginTime = LStrBegin + " 00:00:00"; IStrEndTime = LStrEnd + " 23:59:59"; } if (LStrRangType == "L3M") { CalendarFunctions.GetLastestThreeMonth(ref LStrBegin, ref LStrEnd); IStrBeginTime = LStrBegin + " 00:00:00"; IStrEndTime = LStrEnd + " 23:59:59"; } UC_DateTime_Begin.Value = Convert.ToDateTime(IStrBeginTime); UC_DateTime_End.Value = Convert.ToDateTime(IStrEndTime); } catch (Exception ex) { ShowException(ex.Message); } }
private void UpdateAnimations() { Vector2 sizeLightBounds = new Vector2((float)RootPanel.ActualWidth, (float)RootPanel.ActualHeight); Vector3KeyFrameAnimation lightPositionAnimation; ColorKeyFrameAnimation lightColorAnimation; ComboBoxItem item = LightingSelection.SelectedValue as ComboBoxItem; switch ((LightingTypes)item.Tag) { case LightingTypes.PointDiffuse: case LightingTypes.PointSpecular: { float zDistance = 50f; // Create the light position animation lightPositionAnimation = _compositor.CreateVector3KeyFrameAnimation(); lightPositionAnimation.InsertKeyFrame(0f, new Vector3(0f, 0f, zDistance)); lightPositionAnimation.InsertKeyFrame(.25f, new Vector3(sizeLightBounds.X * .2f, sizeLightBounds.Y * .5f, zDistance)); lightPositionAnimation.InsertKeyFrame(.50f, new Vector3(sizeLightBounds.X * .75f, sizeLightBounds.Y * .5f, zDistance)); lightPositionAnimation.InsertKeyFrame(.75f, new Vector3(sizeLightBounds.X * .2f, sizeLightBounds.Y * .2f, zDistance)); lightPositionAnimation.InsertKeyFrame(1f, new Vector3(0f, 0f, zDistance)); lightPositionAnimation.Duration = TimeSpan.FromMilliseconds(7500); lightPositionAnimation.IterationBehavior = AnimationIterationBehavior.Forever; lightColorAnimation = _compositor.CreateColorKeyFrameAnimation(); lightColorAnimation.InsertKeyFrame(0f, Colors.White); lightColorAnimation.InsertKeyFrame(.33f, Colors.White); lightColorAnimation.InsertKeyFrame(.66f, Colors.Yellow); lightColorAnimation.InsertKeyFrame(1f, Colors.White); lightColorAnimation.Duration = TimeSpan.FromMilliseconds(20000); lightColorAnimation.IterationBehavior = AnimationIterationBehavior.Forever; _pointLight.StartAnimation("Offset", lightPositionAnimation); _pointLight.StartAnimation("Color", lightColorAnimation); } break; case LightingTypes.SpotLightDiffuse: case LightingTypes.SpotLightSpecular: { // Create the light position animation lightPositionAnimation = _compositor.CreateVector3KeyFrameAnimation(); lightPositionAnimation.InsertKeyFrame(0f, new Vector3(0f, 0f, 100f)); lightPositionAnimation.InsertKeyFrame(.33f, new Vector3(sizeLightBounds.X * .5f, sizeLightBounds.Y * .5f, 200f)); lightPositionAnimation.InsertKeyFrame(.66f, new Vector3(sizeLightBounds.X, sizeLightBounds.Y * .5f, 400f)); lightPositionAnimation.InsertKeyFrame(1f, new Vector3(0f, 0f, 100f)); lightPositionAnimation.Duration = TimeSpan.FromMilliseconds(7500); lightPositionAnimation.IterationBehavior = AnimationIterationBehavior.Forever; lightColorAnimation = _compositor.CreateColorKeyFrameAnimation(); lightColorAnimation.InsertKeyFrame(0f, Colors.White); lightColorAnimation.InsertKeyFrame(.33f, Colors.White); lightColorAnimation.InsertKeyFrame(.66f, Colors.Yellow); lightColorAnimation.InsertKeyFrame(1f, Colors.White); lightColorAnimation.Duration = TimeSpan.FromMilliseconds(20000); lightColorAnimation.IterationBehavior = AnimationIterationBehavior.Forever; _spotLight.StartAnimation("Offset", lightPositionAnimation); _spotLight.StartAnimation("InnerConeColor", lightColorAnimation); } break; case LightingTypes.DistantDiffuse: case LightingTypes.DistantSpecular: { // Animate the light direction Vector3 position = new Vector3(0, 0, 100); float offCenter = 700f; Vector3KeyFrameAnimation lightDirectionAnimation = _compositor.CreateVector3KeyFrameAnimation(); lightDirectionAnimation.InsertKeyFrame(0f, Vector3.Normalize(new Vector3(0, 0, 0) - position)); lightDirectionAnimation.InsertKeyFrame(.25f, Vector3.Normalize(new Vector3(offCenter, 0, 0) - position)); lightDirectionAnimation.InsertKeyFrame(.5f, Vector3.Normalize(new Vector3(-offCenter, offCenter, 0) - position)); lightDirectionAnimation.InsertKeyFrame(.75f, Vector3.Normalize(new Vector3(0, -offCenter, 0) - position)); lightDirectionAnimation.InsertKeyFrame(1f, Vector3.Normalize(new Vector3(0, 0, 0) - position)); lightDirectionAnimation.Duration = TimeSpan.FromMilliseconds(7500); lightDirectionAnimation.IterationBehavior = AnimationIterationBehavior.Forever; _distantLight.StartAnimation("Direction", lightDirectionAnimation); } break; default: break; } }
private void BesoinSpeB_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem temp = (ComboBoxItem)BesoinSpeB.SelectedItem; b.BesoinSpecifique = bool.Parse(temp.Content.ToString()); }
public BackgroundInstanceEditor(BackgroundInstance item) { InitializeComponent(); this.item = item; xInput.Value = item.BaseX; yInput.Value = item.BaseY; if (item.Z == -1) { zInput.Enabled = false; } else { zInput.Value = item.Z; } pathLabel.Text = HaCreatorStateManager.CreateItemDescription(item); typeBox.Items.AddRange((object[])Tables.BackgroundTypeNames.Cast <object>()); typeBox.SelectedIndex = (int)item.type; alphaBox.Value = item.a; front.Checked = item.front; rxBox.Value = item.rx; ryBox.Value = item.ry; cxBox.Value = item.cx; cyBox.Value = item.cy; // Resolutions foreach (RenderResolution val in Enum.GetValues(typeof(RenderResolution))) { ComboBoxItem comboBoxItem = new ComboBoxItem { Tag = val, Content = RenderResolutionExtensions.ToReadableString(val) }; comboBox_screenMode.Items.Add(comboBoxItem); } comboBox_screenMode.DisplayMember = "Content"; int i = 0; foreach (ComboBoxItem citem in comboBox_screenMode.Items) { if ((int)((RenderResolution)citem.Tag) == item.screenMode) { comboBox_screenMode.SelectedIndex = i; break; } i++; } if (item.screenMode < 0) { comboBox_screenMode.SelectedIndex = 0; } // Spine BackgroundInfo baseInfo = (BackgroundInfo)item.BaseInfo; if (baseInfo.WzSpineAnimationItem == null) { groupBox_spine.Enabled = false; // disable editing } else { groupBox_spine.Enabled = true; // editing foreach (Animation ani in baseInfo.WzSpineAnimationItem.SkeletonData.Animations) { ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Tag = ani; comboBoxItem.Content = ani.Name; comboBox_spineAnimation.Items.Add(comboBoxItem); } comboBox_spineAnimation.DisplayMember = "Content"; int i_animation = 0; foreach (ComboBoxItem citem in comboBox_spineAnimation.Items) { if (((Animation)citem.Tag).Name == item.SpineAni) { comboBox_spineAnimation.SelectedIndex = i_animation; break; } i_animation++; } // spineRandomStart checkbox checkBox_spineRandomStart.Checked = item.SpineRandomStart; } }
void GetClassMembers(SymScope ss, ArrayList items) { if (ss != null && ss.members != null) { ArrayList meths = new ArrayList(); ArrayList fields = new ArrayList(); ArrayList events = new ArrayList(); ArrayList vars = new ArrayList(); ArrayList props = new ArrayList(); ArrayList consts = new ArrayList(); foreach (SymScope el in ss.members) //if (el.si.kind == SymbolKind.Method || el.si.kind == SymbolKind.Constant || el.si.kind == SymbolKind.Variable || el.si.kind == SymbolKind.Event || el.si.kind == SymbolKind.Field //|| el.si.kind == SymbolKind.Property) if (el.GetPosition().file_name != null) { ComboBoxItem cbi = new ComboBoxItem(el, el.GetDescriptionWithoutDoc(), CodeCompletionProvider.ImagesProvider.GetPictureNum(el.si), true, false); switch (el.si.kind) { case SymbolKind.Method: meths.Add(cbi); break; case SymbolKind.Field: fields.Add(cbi); break; case SymbolKind.Property: props.Add(cbi); break; case SymbolKind.Variable: vars.Add(cbi); break; case SymbolKind.Event: events.Add(cbi); break; case SymbolKind.Constant: consts.Add(cbi); break; } //items.Add(new ComboBoxItem(el,el.GetDescriptionWithoutDoc(),CodeCompletionProvider.ImagesProvider.GetPictureNum(el.si),true)); } meths.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture)); items.AddRange(meths); props.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture)); items.AddRange(props); fields.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture)); items.AddRange(fields); vars.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture)); items.AddRange(vars); consts.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture)); items.AddRange(consts); events.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture)); items.AddRange(events); } }
private void Btn_Create(object sender, RoutedEventArgs e) { Data.HostOrClient = true; Data.CreateToServer = true; WriteSetting(); // Get the value from the combobox to the string ComboBoxItem typeItem = (ComboBoxItem)LobbyType.SelectedItem; string value = typeItem.Content.ToString(); string _usePass; if ((bool)PassUse.IsChecked == true) { _usePass = "******" + PasswInput.Text; } else { _usePass = "******"; } if (Data.SettingCh.St.UseMod) { Data.ModOrOrigin = "Mod"; } else { Data.ModOrOrigin = "Orig"; } Data.Password = PasswInput.Text; Get _max = new Get(); // Assign the name of the lobby if (LobbyName.Text != "") { Data.NameSession = LobbyName.Text; } else { Data.NameSession = "Lobby by " + Data.SettingCh.St.Name; } string name; if (Data.NameSession.Length > 16) { name = Data.NameSession.Substring(0, 16) + "..."; } else { name = Data.NameSession; } Data.LobbyTitle = name + " [ " + ModOrig.Text + " | " + typeItem.Content.ToString() + _usePass + "]"; // Assign a comment Data.Comment = CommentInput.Text; Data.MaxGamers = _max.GetMaxCountGamers(LobbyType.SelectedIndex); Data.GamersList.LobbyType = typeItem.Content.ToString(); Data.GamersList.ModOrig = ModOrig.Text.ToString(); Host host = new Host(); host.StartListening(Data.SettingCh.St.TcpPort); }
public void RegistrarPersona() { try { ValidacionesMantenimiento validacion = new ValidacionesMantenimiento(); bool valido = true; //foreach (TextBox txb in grdValidar.Children) //{ // BrushConverter bc = new BrushConverter(); // txb.Foreground = (Brush)bc.ConvertFrom("#FF000000"); // if (validacion.Validar(txb.Text, Convert.ToInt32(txb.Tag)) == false) // { // valido = false; // txb.Foreground = (Brush)bc.ConvertFrom("#FFFF0404"); // } //} if (valido == true) { nuevaPersona = new SIGEEA_Persona(); if (tipoPersona == "Cliente") { if (cbxEmpresa.IsChecked == false) { nuevaPersona.CedParticular_Persona = txbCedula.Text; if (dtpFecNacimiento.SelectedDate != null) { nuevaPersona.FecNacimiento_Persona = dtpFecNacimiento.SelectedDate.Value; } nuevaPersona.FK_Id_Direccion = null; nuevaPersona.Tipo_Persona = true; nuevaPersona.CedJuridica_Persona = null; nuevaPersona.FK_Id_Nacionalidad = ucNacionalidad.getNacionalidad(); ComboBoxItem item = (ComboBoxItem)cbxGenero.SelectedItem; nuevaPersona.Genero_Persona = item.Content.ToString(); nuevaPersona.PriApellido_Persona = txbPriApellido.Text; nuevaPersona.PriNombre_Persona = txbPriNombre.Text; nuevaPersona.SegApellido_Persona = txbSegApellido.Text; nuevaPersona.SegNombre_Persona = txbSegNombre.Text; } else { nuevaPersona.CedParticular_Persona = null; nuevaPersona.CedJuridica_Persona = txbCedula.Text; if (dtpFecNacimiento.SelectedDate != null) { nuevaPersona.FecNacimiento_Persona = dtpFecNacimiento.SelectedDate.Value; } nuevaPersona.FK_Id_Direccion = null; nuevaPersona.Tipo_Persona = false; nuevaPersona.FK_Id_Nacionalidad = ucNacionalidad.getNacionalidad(); nuevaPersona.Genero_Persona = null; nuevaPersona.PriApellido_Persona = null; nuevaPersona.PriNombre_Persona = txbPriNombre.Text; nuevaPersona.SegApellido_Persona = null; nuevaPersona.SegNombre_Persona = null; } cbxEmpresa.Visibility = Visibility.Hidden; } else { nuevaPersona.CedParticular_Persona = txbCedula.Text; if (dtpFecNacimiento.SelectedDate != null) { nuevaPersona.FecNacimiento_Persona = dtpFecNacimiento.SelectedDate.Value; } nuevaPersona.FK_Id_Direccion = null; nuevaPersona.Tipo_Persona = true; nuevaPersona.CedJuridica_Persona = null; nuevaPersona.FK_Id_Nacionalidad = ucNacionalidad.getNacionalidad(); ComboBoxItem item = (ComboBoxItem)cbxGenero.SelectedItem; nuevaPersona.Genero_Persona = item.Content.ToString(); nuevaPersona.PriApellido_Persona = txbPriApellido.Text; nuevaPersona.PriNombre_Persona = txbPriNombre.Text; nuevaPersona.SegApellido_Persona = txbSegApellido.Text; nuevaPersona.SegNombre_Persona = txbSegNombre.Text; } } } catch (Exception ex) { MessageBox.Show("Los datos ingresados no coinciden con los formatos del sistema: " + ex.Message, "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void OpenSelectDataSourceDialog() { ComboBoxItem selectedPlugIn = cmbDataFormats.SelectedItem as ComboBoxItem; if (selectedPlugIn == null) { throw new GeneralException("No data source plug-in is selected in combo box."); } if (selectedPlugIn.Key == null) // default project { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = SharedStrings.SELECT_DATA_SOURCE; openFileDialog.Filter = "Epi Info " + SharedStrings.PROJECT_FILE + " (*.prj)|*.prj"; openFileDialog.FilterIndex = 1; openFileDialog.Multiselect = false; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK) { string filePath = openFileDialog.FileName.Trim(); if (System.IO.File.Exists(filePath)) { try { selectedDataSource = new Project(filePath); } catch (Exception ex) { MessageBox.Show("Could not load project: \n\n" + ex.Message); return; } } } } else { IDbDriverFactory dbFactory = null; switch (selectedPlugIn.Key) { case "Epi.Data.SqlServer.SqlDBFactory, Epi.Data.SqlServer": dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.SqlDriver); break; case "Epi.Data.MySQL.MySQLDBFactory, Epi.Data.MySQL": dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.MySQLDriver); break; case "Epi.Data.Office.AccessDBFactory, Epi.Data.Office": dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.AccessDriver); break; case "Epi.Data.Office.ExcelWBFactory, Epi.Data.Office": dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.ExcelDriver); break; case "Epi.Data.Office.Excel2007WBFactory, Epi.Data.Office": dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.Excel2007Driver); break; case "Epi.Data.Office.Access2007DBFactory, Epi.Data.Office": dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.Access2007Driver); break; case "Epi.Data.Office.CsvFileFactory, Epi.Data.Office": dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.CsvDriver); break; case "Epi.Data.PostgreSQL.PostgreSQLDBFactory, Epi.Data.PostgreSQL": dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.PostgreSQLDriver); break; default: dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.AccessDriver); break; } DbConnectionStringBuilder dbCnnStringBuilder = new DbConnectionStringBuilder(); IDbDriver db = dbFactory.CreateDatabaseObject(dbCnnStringBuilder); IConnectionStringGui dialog = dbFactory.GetConnectionStringGuiForExistingDb(); DialogResult result = ((Form)dialog).ShowDialog(); if (result == DialogResult.OK) { bool success = false; db.ConnectionString = dialog.DbConnectionStringBuilder.ToString(); txtFileName.Text = db.ConnectionDescription; try { success = db.TestConnection(); } catch { success = false; MessageBox.Show("Could not connect to selected data source."); } if (success) { this.selectedDataSource = db; } else { this.selectedDataSource = null; } } else { this.selectedDataSource = null; } } LoadTables(); }
private void confirmar_Click(object sender, RoutedEventArgs e) { //verificar se um tamanho foi selecionado if (cbTamanho.SelectedIndex <= -1) { Xceed.Wpf.Toolkit.MessageBox.Show("Por favor, selecione o tamanho a atribuir ao produto!", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } //verificar se uma cor foi selecionada if (txtCor.SelectedColorText == "") { Xceed.Wpf.Toolkit.MessageBox.Show("Por favor, selecione uma cor a atribuir ao produto!", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (txtPreço.Text == "") { Xceed.Wpf.Toolkit.MessageBox.Show("Por favor, indique o preço a atribuir ao produto!", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (Convert.ToDouble(txtPreço.Text) <= 0) { Xceed.Wpf.Toolkit.MessageBox.Show("O preço do produto deve ser maior que 0!", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (rdEtiquetaExis.IsChecked == false && rdEtiquetaNova.IsChecked == false) { Xceed.Wpf.Toolkit.MessageBox.Show("Por favor, adicione uma etiqueta existente ao produto, ou crie uma nova!", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } //validar os formularios de preenchimento de uma etiqueta nova if (rdEtiquetaNova.IsChecked == true) { if (txtNormas.Text.Length == 0 || txtComp.Text.Length == 0 || txtPais.Text.Length == 0) { Xceed.Wpf.Toolkit.MessageBox.Show("Por favor, preencha todos os campos relativos à criação de nova etiqueta!", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (txtNormas.Text.Length > 100) { Xceed.Wpf.Toolkit.MessageBox.Show("A especificação das normas é demasiado longa! Indique apenas o essencial.", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (txtComp.Text.Length > 100) { Xceed.Wpf.Toolkit.MessageBox.Show("A especificação da composição da etiqueta é demasiado longa! Indique apenas o essencial.", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (txtPais.Text.Length > 20) { Xceed.Wpf.Toolkit.MessageBox.Show("O nome do País especificado é demasiado longo! Use acrónimos ou abreviações.", "", MessageBoxButton.OK, MessageBoxImage.Error); return; } } ProdutoPersonalizado prodPers = new ProdutoPersonalizado(); Boolean inserirEtiqueta = true; try { ComboBoxItem cbi = (ComboBoxItem)cbTamanho.SelectedItem; prodPers.Tamanho = cbi.Content.ToString(); prodPers.Cor = txtCor.SelectedColorText; Console.WriteLine(cbi.Content.ToString()); prodPers.Preco = Convert.ToDouble(txtPreço.Text); prodPers.ProdutoBase = new ProdutoBase(); prodPers.ProdutoBase = (ProdutoBase)cbProdBase.SelectedItem; prodPers.MateriaisTexteis = new ObservableCollection <MaterialTextil>(); prodPers.Etiqueta = new Etiqueta(); if (rdEtiquetaExis.IsChecked == true) { prodPers.Etiqueta = (Etiqueta)cbEtiqueta.SelectedItem; inserirEtiqueta = false; } else if (rdEtiquetaNova.IsChecked == true) { prodPers.Etiqueta.Normas = txtNormas.Text; prodPers.Etiqueta.Composicao = txtComp.Text; prodPers.Etiqueta.PaisFabrico = txtPais.Text; inserirEtiqueta = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); return; } RegistarProdutoMateriais page = new RegistarProdutoMateriais(dataHandler, prodPers, listaMateriais, inserirEtiqueta); this.NavigationService.Navigate(page); }
private void FreqSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (periodText == null) { return; } switch (freqCmb.SelectedIndex) { case 0: periodText.Text = ""; weekDayGrid.Visibility = Visibility.Hidden; monthDayCmb.Visibility = Visibility.Hidden; yearDayTxt.Visibility = Visibility.Hidden; break; case 1: periodText.Text = "Dia(s):"; weekDayGrid.Visibility = Visibility.Visible; monthDayCmb.Visibility = Visibility.Hidden; yearDayTxt.Visibility = Visibility.Hidden; break; case 2: periodText.Text = "Dia:"; weekDayGrid.Visibility = Visibility.Hidden; monthDayCmb.Visibility = Visibility.Visible; yearDayTxt.Visibility = Visibility.Hidden; if (dateCalendar.SelectedDate != null) { DateTime selectedDate = (DateTime)dateCalendar.SelectedDate; int dayOfMonth = selectedDate.Day; var culture = new System.Globalization.CultureInfo("pt-BR"); string dayOfWeek = culture.DateTimeFormat.GetDayName(selectedDate.DayOfWeek); int weekOfMonth = (dayOfMonth - 1) / 7 + 1; monthDayCmb.Items.Clear(); ComboBoxItem newItem = new ComboBoxItem { IsSelected = true, Content = "Mensalmente no dia " + dayOfMonth }; monthDayCmb.Items.Add(newItem); newItem = new ComboBoxItem(); if (selectedDate.DayOfWeek == DayOfWeek.Monday || selectedDate.DayOfWeek == DayOfWeek.Saturday) { newItem.Content = "Todo " + weekOfMonth + "º " + dayOfWeek + " do mês"; } else { newItem.Content = "Toda " + weekOfMonth + "ª " + dayOfWeek + " do mês"; } monthDayCmb.Items.Add(newItem); } break; case 3: periodText.Text = "Dia:"; weekDayGrid.Visibility = Visibility.Hidden; monthDayCmb.Visibility = Visibility.Hidden; yearDayTxt.Visibility = Visibility.Visible; if (dateCalendar.SelectedDate != null) { yearDayTxt.Text = "Todos os anos no dia " + ((DateTime)dateCalendar.SelectedDate).ToString("dd/MM"); } break; } }
private void Button_Click(object sender, RoutedEventArgs e) { ComboBoxItem item = (ComboBoxItem)combobox.SelectedItem; textbox.Text = item.Content.ToString(); }
private void LightTypeSelection_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem item = LightTypeSelection.SelectedValue as ComboBoxItem; LightTypes lightType = (LightTypes)item.Tag; switch (lightType) { case LightTypes.PointLight: XOffsetRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); YOffsetRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); ZOffsetRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); ConstantAttenuationRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); LinearAttenuationRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); QuadraticAttenuationRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); InnerConeRow.Height = new Windows.UI.Xaml.GridLength(0); OuterConeRow.Height = new Windows.UI.Xaml.GridLength(0); InnerConeColorRow.Height = new Windows.UI.Xaml.GridLength(0); OuterConeColorRow.Height = new Windows.UI.Xaml.GridLength(0); LightColorRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); DirectionXRow.Height = new Windows.UI.Xaml.GridLength(0); DirectionYRow.Height = new Windows.UI.Xaml.GridLength(0); break; case LightTypes.SpotLight: XOffsetRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); YOffsetRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); ZOffsetRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); ConstantAttenuationRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); LinearAttenuationRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); QuadraticAttenuationRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); InnerConeRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); OuterConeRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); InnerConeColorRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); OuterConeColorRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); LightColorRow.Height = new Windows.UI.Xaml.GridLength(0); DirectionXRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); DirectionYRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); break; case LightTypes.DistantLight: XOffsetRow.Height = new Windows.UI.Xaml.GridLength(0); YOffsetRow.Height = new Windows.UI.Xaml.GridLength(0); ZOffsetRow.Height = new Windows.UI.Xaml.GridLength(0); ConstantAttenuationRow.Height = new Windows.UI.Xaml.GridLength(0); LinearAttenuationRow.Height = new Windows.UI.Xaml.GridLength(0); QuadraticAttenuationRow.Height = new Windows.UI.Xaml.GridLength(0); InnerConeRow.Height = new Windows.UI.Xaml.GridLength(0); OuterConeRow.Height = new Windows.UI.Xaml.GridLength(0); InnerConeColorRow.Height = new Windows.UI.Xaml.GridLength(0); OuterConeColorRow.Height = new Windows.UI.Xaml.GridLength(0); LightColorRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); DirectionXRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); DirectionYRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); break; default: break; } // Update UI for selected light type if (lightType == LightTypes.SpotLight) { InnerConeRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); OuterConeRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); InnerConeColorRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); OuterConeColorRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); LightColorRow.Height = new Windows.UI.Xaml.GridLength(0); } else { InnerConeRow.Height = new Windows.UI.Xaml.GridLength(0); OuterConeRow.Height = new Windows.UI.Xaml.GridLength(0); InnerConeColorRow.Height = new Windows.UI.Xaml.GridLength(0); OuterConeColorRow.Height = new Windows.UI.Xaml.GridLength(0); LightColorRow.Height = new Windows.UI.Xaml.GridLength(1, Windows.UI.Xaml.GridUnitType.Auto); } UpdateLight(); }
private void MaintanceB_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem temp = (ComboBoxItem)MaintanceB.SelectedItem; b.Maintenance = bool.Parse(temp.Content.ToString()); }
private void UpdateLight() { if (LightTypeSelection.SelectedValue != null) { ComboBoxItem item = LightTypeSelection.SelectedValue as ComboBoxItem; LightTypes lightType = (LightTypes)item.Tag; if (_light != null) { _light.Targets.RemoveAll(); } switch (lightType) { case LightTypes.PointLight: { PointLight light = _compositor.CreatePointLight(); light.CoordinateSpace = CoordinateSpace; light.Offset = new Vector3((float)XOffset.Value, (float)YOffset.Value, (float)ZOffset.Value); light.ConstantAttenuation = (float)ConstantAttenuation.Value / c_ConstantAttenRange; light.LinearAttenuation = (float)LinearAttenuation.Value / c_LinearAttenRange * .1f; light.QuadraticAttenuation = (float)QuadraticAttenuation.Value / c_QuadraticAttenRange * .01f; light.Color = LightColor.Color; _light = light; } break; case LightTypes.SpotLight: { SpotLight light = _compositor.CreateSpotLight(); light.CoordinateSpace = CoordinateSpace; light.Offset = new Vector3((float)XOffset.Value, (float)YOffset.Value, (float)ZOffset.Value); light.ConstantAttenuation = (float)ConstantAttenuation.Value / c_ConstantAttenRange; light.LinearAttenuation = (float)LinearAttenuation.Value / c_LinearAttenRange * .1f; light.QuadraticAttenuation = (float)QuadraticAttenuation.Value / c_QuadraticAttenRange * .01f; light.InnerConeAngleInDegrees = (float)InnerCone.Value; light.InnerConeColor = InnerConeColor.Color; light.OuterConeAngleInDegrees = (float)OuterCone.Value; light.OuterConeColor = OuterConeColor.Color; Vector3 lookAt = new Vector3((float)DirectionX.Value, (float)DirectionY.Value, 0); Vector3 direction = Vector3.Normalize(lookAt - new Vector3(300, 300, 300)); light.Direction = direction; _light = light; } break; case LightTypes.DistantLight: { DistantLight light = _compositor.CreateDistantLight(); light.CoordinateSpace = CoordinateSpace; light.Color = LightColor.Color; Vector3 lookAt = new Vector3((float)DirectionX.Value, (float)DirectionY.Value, 0); Vector3 offset = new Vector3(300, 300, 100); light.Direction = Vector3.Normalize(lookAt - offset); _light = light; } break; default: Debug.Assert(false, "Unexpected type"); break; } // Add the visual to the light target collection foreach (Visual target in _targetVisualList) { _light.Targets.Add(target); } } }
private void OuvertB_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem temp = (ComboBoxItem)OuvertB.SelectedItem; b.Ouvert = bool.Parse(temp.Content.ToString()); }
private void btnAddContact_Click(object sender, RoutedEventArgs e) { if (allFieldsFilled()) { //Store birthday string[] yearValue = comboYear.SelectedValue.ToString().Split(new char[] { ':' }); string[] monthValue = comboMonth.SelectedValue.ToString().Split(new char[] { ':' }); string[] dayValue = comboDay.SelectedValue.ToString().Split(new char[] { ':' }); int year; int month; int day; int.TryParse(yearValue[1], out year); int.TryParse(monthValue[1], out month); int.TryParse(dayValue[1], out day); //Check for errors if (isValidDate(year, month, day)) { if (allLegalCharacters()) { if (isNotRepeat()) { DateTime bDay = new DateTime(year, month, day); //Add new contact Contact contact = new Contact(txtFirstName.Text, txtLastName.Text, bDay, txtEmail.Text); contacts.Add(contact); //Add new combobox item ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Content = contact.getFullName(); contactBoxes.Add(comboBoxItem); comboContact.Items.Add(comboBoxItem); //Update interface viewDefaultInterface(); comboContact.SelectedItem = null; txtFirstName.Text = ""; txtLastName.Text = ""; comboYear.SelectedItem = null; comboMonth.SelectedItem = null; comboDay.SelectedItem = null; txtEmail.Text = ""; } //error: repeat else { lblFeedback.Foreground = Brushes.Red; lblFeedback.Content = "There is already a contact with that name."; lblFeedback.Visibility = Visibility.Visible; } } //error: illegal characters else { lblFeedback.Foreground = Brushes.Red; lblFeedback.Content = "Please don't ues the following characters: , : ; \\ \""; lblFeedback.Visibility = Visibility.Visible; } } //error: invalid date else { lblFeedback.Foreground = Brushes.Red; lblFeedback.Content = "Invalid date selected"; lblFeedback.Visibility = Visibility.Visible; } } //error: empty fields else { lblFeedback.Foreground = Brushes.Red; lblFeedback.Content = "Please fill all fields"; lblFeedback.Visibility = Visibility.Visible; } }
private static System.Collections.ObjectModel.ObservableCollection<object> Get_cbLanguage_Items() { System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>(); // e_32 element ComboBoxItem e_32 = new ComboBoxItem(); e_32.Name = "e_32"; e_32.Tag = "en"; e_32.SetResourceReference(ComboBoxItem.ContentProperty, "EnglishText"); items.Add(e_32); // e_33 element ComboBoxItem e_33 = new ComboBoxItem(); e_33.Name = "e_33"; e_33.Tag = "de"; e_33.SetResourceReference(ComboBoxItem.ContentProperty, "GermanText"); items.Add(e_33); // e_34 element ComboBoxItem e_34 = new ComboBoxItem(); e_34.Name = "e_34"; e_34.Tag = "fr"; e_34.SetResourceReference(ComboBoxItem.ContentProperty, "FrenchText"); items.Add(e_34); // e_35 element ComboBoxItem e_35 = new ComboBoxItem(); e_35.Name = "e_35"; e_35.Tag = "cs"; e_35.SetResourceReference(ComboBoxItem.ContentProperty, "CzechText"); items.Add(e_35); return items; }
public MainWindow() { InitializeComponent(); viewDefaultInterface(); //Read from file System.IO.StreamReader sr = new System.IO.StreamReader("contacts.txt"); while (!sr.EndOfStream) { string tempFirstName; string tempLastName; DateTime tempBirthday; int tempYear; int tempMonth; int tempDay; string tempEmail; string line = sr.ReadLine(); string[] items = line.Split(new char[] { ',' }); tempFirstName = items[0]; tempLastName = items[1]; int.TryParse(items[2], out tempYear); int.TryParse(items[3], out tempMonth); int.TryParse(items[4], out tempDay); tempBirthday = new DateTime(tempYear, tempMonth, tempDay); tempEmail = items[5]; Contact contact = new Contact(tempFirstName, tempLastName, tempBirthday, tempEmail); contacts.Add(contact); } sr.Close(); //comboContact Setup foreach (Contact contact in contacts) { ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Content = contact.getFullName(); contactBoxes.Add(comboBoxItem); comboContact.Items.Add(comboBoxItem); } //comboYear Setup for (int i = DateTime.Now.Year; i >= 1900; i--) { ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Content = i.ToString(); comboYear.Items.Add(comboBoxItem); } //comboMonth Setup for (int i = 1; i <= 12; i++) { ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Content = i.ToString(); comboMonth.Items.Add(comboBoxItem); } //comboDay Setup for (int i = 1; i <= 31; i++) { ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Content = i.ToString(); comboDay.Items.Add(comboBoxItem); } }
private static System.Collections.ObjectModel.ObservableCollection<object> Get_combo_Items() { System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>(); // item1 element ComboBoxItem item1 = new ComboBoxItem(); item1.Name = "item1"; item1.Content = "Item 1"; items.Add(item1); // item2 element ComboBoxItem item2 = new ComboBoxItem(); item2.Name = "item2"; item2.Content = "Item 2"; items.Add(item2); // item3 element ComboBoxItem item3 = new ComboBoxItem(); item3.Name = "item3"; item3.Content = "Item 3"; item3.IsSelected = true; items.Add(item3); return items; }
private void UpdateLightingEffect() { _ambientLight.Targets.RemoveAll(); _pointLight.Targets.RemoveAll(); _distantLight.Targets.RemoveAll(); _spotLight.Targets.RemoveAll(); ComboBoxItem item = LightingSelection.SelectedValue as ComboBoxItem; switch ((LightingTypes)item.Tag) { case LightingTypes.PointDiffuse: { // // Result = Ambient + Diffuse // Result = (Image) + (.75 * Diffuse color) // IGraphicsEffect graphicsEffect = new CompositeEffect() { Mode = CanvasComposite.Add, Sources = { new CompositionEffectSourceParameter("ImageSource"), new SceneLightingEffect() { AmbientAmount = 0, DiffuseAmount = .75f, SpecularAmount = 0, NormalMapSource = new CompositionEffectSourceParameter("NormalMap"), } } }; _effectFactory = _compositor.CreateEffectFactory(graphicsEffect); // Set the light coordinate space and add the target Visual lightRoot = ElementCompositionPreview.GetElementVisual(ThumbnailList); _pointLight.CoordinateSpace = lightRoot; _pointLight.Targets.Add(lightRoot); } break; case LightingTypes.PointSpecular: { // // Result = Ambient + Diffuse + Specular // Result = (Image * .6) + (Image * Diffuse color) + (Specular color) // IGraphicsEffect graphicsEffect = new CompositeEffect() { Mode = CanvasComposite.DestinationIn, Sources = { new ArithmeticCompositeEffect() { Source1Amount = 1, Source2Amount = 1, MultiplyAmount = 0, Source1 = new ArithmeticCompositeEffect() { MultiplyAmount = 1, Source1Amount = 0, Source2Amount = 0, Source1 = new CompositionEffectSourceParameter("ImageSource"), Source2 = new SceneLightingEffect() { AmbientAmount = .6f, DiffuseAmount = 1f, SpecularAmount = 0f, NormalMapSource = new CompositionEffectSourceParameter("NormalMap"), } }, Source2 = new SceneLightingEffect() { AmbientAmount = 0, DiffuseAmount = 0f, SpecularAmount = 1f, SpecularShine = 100, NormalMapSource = new CompositionEffectSourceParameter("NormalMap"), } }, new CompositionEffectSourceParameter("NormalMap"), } }; _effectFactory = _compositor.CreateEffectFactory(graphicsEffect); // Set the light coordinate space and add the target Visual lightRoot = ElementCompositionPreview.GetElementVisual(ThumbnailList); _ambientLight.Targets.Add(lightRoot); _pointLight.CoordinateSpace = lightRoot; _pointLight.Targets.Add(lightRoot); } break; case LightingTypes.SpotLightDiffuse: { // // Result = Ambient + Diffuse // Result = Image + (Diffuse color * .75) // IGraphicsEffect graphicsEffect = new CompositeEffect() { Mode = CanvasComposite.Add, Sources = { new CompositionEffectSourceParameter("ImageSource"), new SceneLightingEffect() { AmbientAmount = 0, DiffuseAmount = .75f, SpecularAmount = 0, NormalMapSource = new CompositionEffectSourceParameter("NormalMap"), } } }; _effectFactory = _compositor.CreateEffectFactory(graphicsEffect); // Set the light coordinate space and add the target Visual lightRoot = ElementCompositionPreview.GetElementVisual(ThumbnailList); _spotLight.CoordinateSpace = lightRoot; _spotLight.Targets.Add(lightRoot); _spotLight.InnerConeAngle = (float)(Math.PI / 4); _spotLight.OuterConeAngle = (float)(Math.PI / 3.5); _spotLight.Direction = new Vector3(0, 0, -1); }; break; case LightingTypes.SpotLightSpecular: { // // Result = Ambient + Diffuse + Specular // Result = (Image * .6) + (Image * Diffuse color) + (Specular color) // IGraphicsEffect graphicsEffect = new CompositeEffect() { Mode = CanvasComposite.DestinationIn, Sources = { new ArithmeticCompositeEffect() { Source1Amount = 1, Source2Amount = 1, MultiplyAmount = 0, Source1 = new ArithmeticCompositeEffect() { MultiplyAmount = 1, Source1Amount = 0, Source2Amount = 0, Source1 = new CompositionEffectSourceParameter("ImageSource"), Source2 = new SceneLightingEffect() { AmbientAmount = .6f, DiffuseAmount = 1f, SpecularAmount = 0f, NormalMapSource = new CompositionEffectSourceParameter("NormalMap"), } }, Source2 = new SceneLightingEffect() { AmbientAmount = 0, DiffuseAmount = 0f, SpecularAmount = 1f, SpecularShine = 100, NormalMapSource = new CompositionEffectSourceParameter("NormalMap"), } }, new CompositionEffectSourceParameter("NormalMap"), } }; // Create the effect factory _effectFactory = _compositor.CreateEffectFactory(graphicsEffect); // Set the light coordinate space and add the target Visual lightRoot = ElementCompositionPreview.GetElementVisual(ThumbnailList); _ambientLight.Targets.Add(lightRoot); _spotLight.CoordinateSpace = lightRoot; _spotLight.Targets.Add(lightRoot); _spotLight.InnerConeAngle = (float)(Math.PI / 4); _spotLight.OuterConeAngle = (float)(Math.PI / 3.5); _spotLight.Direction = new Vector3(0, 0, -1); }; break; case LightingTypes.DistantDiffuse: { // // Result = Ambient + Diffuse // Result = (Image) + (.5 * Diffuse color) // IGraphicsEffect graphicsEffect = new CompositeEffect() { Mode = CanvasComposite.DestinationIn, Sources = { new CompositeEffect() { Mode = CanvasComposite.Add, Sources = { new CompositionEffectSourceParameter("ImageSource"), new SceneLightingEffect() { AmbientAmount = 0, DiffuseAmount = .5f, SpecularAmount = 0, NormalMapSource = new CompositionEffectSourceParameter("NormalMap"), } } }, new CompositionEffectSourceParameter("NormalMap"), } }; _effectFactory = _compositor.CreateEffectFactory(graphicsEffect); Visual lightRoot = ElementCompositionPreview.GetElementVisual(ThumbnailList); _distantLight.CoordinateSpace = lightRoot; _distantLight.Targets.Add(lightRoot); }; break; case LightingTypes.DistantSpecular: { // // Result = Diffuse + Specular // Result = (Image * Diffuse color) + (Specular color) // IGraphicsEffect graphicsEffect = new CompositeEffect() { Mode = CanvasComposite.DestinationIn, Sources = { new ArithmeticCompositeEffect() { Source1Amount = 1, Source2Amount = 1, MultiplyAmount = 0, Source1 = new ArithmeticCompositeEffect() { MultiplyAmount = 1, Source1Amount = 0, Source2Amount = 0, Source1 = new CompositionEffectSourceParameter("ImageSource"), Source2 = new SceneLightingEffect() { AmbientAmount = .6f, DiffuseAmount = 1f, SpecularAmount = 0f, NormalMapSource = new CompositionEffectSourceParameter("NormalMap"), } }, Source2 = new SceneLightingEffect() { AmbientAmount = 0, DiffuseAmount = 0f, SpecularAmount = 1f, SpecularShine = 100, NormalMapSource = new CompositionEffectSourceParameter("NormalMap"), } }, new CompositionEffectSourceParameter("NormalMap"), } }; _effectFactory = _compositor.CreateEffectFactory(graphicsEffect); Visual lightRoot = ElementCompositionPreview.GetElementVisual(ThumbnailList); _distantLight.CoordinateSpace = lightRoot; _distantLight.Targets.Add(lightRoot); }; break; default: break; } // Update the animations UpdateAnimations(); // Update all the image to have the new effect UpdateEffectBrush(); }
public static List<ComboBoxItem> GetLanguageList() { if (LanguageItems == null) { LanguageItems = new List<ComboBoxItem>(); foreach (Language language in Languages.Values) { ComboBoxItem c = new ComboBoxItem(); c.Style = Application.Current.FindResource("ComboBoxItem") as Style; StackPanel panel = new StackPanel(); panel.Orientation = Orientation.Horizontal; c.Content = panel; string fileName = "langs/" + language.Resource["LangCode"] + ".png"; if (System.IO.File.Exists(fileName)) { MemoryStream ms = new MemoryStream(); FileStream stream = new FileStream(fileName, FileMode.Open); ms.SetLength(stream.Length); stream.Read(ms.GetBuffer(), 0, (int)stream.Length); ms.Flush(); stream.Close(); Image i = new Image(); BitmapImage img = new BitmapImage(); img.BeginInit(); img.StreamSource = ms; img.EndInit(); i.Source = img; i.Margin = new Thickness(0, 0, 10, 0); panel.Children.Add(i); } TextBlock text = new TextBlock(); text.Name = "Label"; text.VerticalAlignment = VerticalAlignment.Center; text.Text = language.Resource["LangName"] as String; panel.Children.Add(text); LanguageItems.Add(c); } } return LanguageItems; }
private void Search() { if (this.radioButtonSearchTestId.IsChecked == true) { if (this.comboBoxFlowSearchTestType.SelectedItem != null) { YellowstonePathology.Business.PanelSet.Model.PanelSet panelSet = (YellowstonePathology.Business.PanelSet.Model.PanelSet) this.comboBoxFlowSearchTestType.SelectedItem; this.m_FlowUI.FlowLogSearch.SetByTestType(panelSet.PanelSetId); this.m_FlowUI.Search(); } } if (this.radioButtonSearchCurrentMonth.IsChecked == true) { this.m_FlowUI.FlowLogSearch.SetByAccessionMonth(DateTime.Today); this.m_FlowUI.Search(); } if (this.radioButtonSearchLeukemiaNotFinal.IsChecked == true) { this.m_FlowUI.FlowLogSearch.SetByLeukemiaNotFinal(); this.m_FlowUI.Search(); } if (this.radioButtonSearchLastMonth.IsChecked == true) { this.m_FlowUI.FlowLogSearch.SetByAccessionMonth(DateTime.Today.AddMonths(-1)); this.m_FlowUI.Search(); } if (this.radioButtonSearchReportNo.IsChecked == true) { String reportNo = this.ReportNoFromText(this.textBoxSearchReportNo.Text); if (string.IsNullOrEmpty(reportNo) == false && reportNo != this.textBoxSearchReportNo.Text) { this.textBoxSearchReportNo.Text = reportNo; } this.m_FlowUI.FlowLogSearch.SetByReportNo(reportNo); this.m_FlowUI.Search(); } if (this.radioButtonSearchPatientName.IsChecked == true) { if (this.textBoxSearchPatientName.Text.Length > 0) { this.m_FlowUI.FlowLogSearch.SetByPatientName(this.textBoxSearchPatientName.Text); this.m_FlowUI.Search(); } } if (this.radioButtonSearchSelectMonth.IsChecked == true) { if (this.comboBoxYear.Text == string.Empty | this.comboBoxMonth.Text == string.Empty) { return; } else { ComboBoxItem item = (ComboBoxItem)this.comboBoxMonth.SelectedItem; int month = Convert.ToInt32(item.Tag.ToString()); int year = Convert.ToInt32(this.comboBoxYear.Text); DateTime date = DateTime.Parse(month.ToString() + "/" + 1 + "/" + year.ToString()); this.m_FlowUI.FlowLogSearch.SetByAccessionMonth(date); this.m_FlowUI.Search(); } } this.tabControlBottomLeftPane.SelectedIndex = 0; this.ListViewFlowCaseList.SelectedIndex = -1; }
private void typeBesoinB_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem temp = (ComboBoxItem)typeBesoinB.SelectedItem; b.TypeDeBesoin = temp.Content.ToString(); }
private void PackageoneType_Change(object sender, SelectionChangedEventArgs e) { if ((sender as ComboBox).SelectedItem != null) { cc3.Items.Clear(); ComboBoxItem tmpp = new ComboBoxItem(); tmpp.Tag = null; tmpp.Content = "Not Used"; cc3.Items.Add(tmpp); ComboBoxItem obj = (ComboBoxItem)((sender as ComboBox).SelectedItem); cc2.IsEnabled = true; if (obj.Tag == null) { _IngredientInfo._InstantPowder.PackageOneType = 0; _IngredientInfo._InstantPowder.PackageOneAmt = 0; return; } CanisterUnit tmp1 = (CanisterUnit)obj.Tag; _IngredientInfo._InstantPowder.PackageOneType = tmp1.Powdertype; foreach (var item in _CanisterUnit) { ComboBoxItem tmp = new ComboBoxItem(); if (tmp1.Postion == 0) { if (item.Postion == 1) { tmp.Tag = item; tmp.Content = item.GetPowdertype(); cc3.Items.Add(tmp); break; } } if (tmp1.Postion == 1) { if (item.Postion == 0) { tmp.Tag = item; tmp.Content = item.GetPowdertype(); cc3.Items.Add(tmp); break; } } if (tmp1.Postion == 2) { if (item.Postion == 3) { tmp.Tag = item; tmp.Content = item.GetPowdertype(); cc3.Items.Add(tmp); break; } } if (tmp1.Postion == 3) { if (item.Postion == 2) { tmp.Tag = item; tmp.Content = item.GetPowdertype(); cc3.Items.Add(tmp); break; } } } } else { // _my._CrtIngredient._InstantPowder.PackageOneType = 0; // _my._CrtIngredient._InstantPowder.PackageOneAmt = 0; cc2.IsEnabled = false; } }
static ComboBox LoadComboBox(ComboBox comboBox) { ComboBox combo = XamlReader.Parse(@" <ComboBox xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""> <ComboBoxItem Content=""AliceBlue"" Background=""AliceBlue""/> <ComboBoxItem Content=""AntiqueWhite"" Background=""AntiqueWhite""/> <ComboBoxItem Content=""Aqua"" Background=""Aqua""/> <ComboBoxItem Content=""AquaMarine"" Background=""AquaMarine""/> <ComboBoxItem Content=""Azure"" Background=""Azure""/> <ComboBoxItem Content=""Beige"" Background=""Beige""/> <ComboBoxItem Content=""Bisque"" Background=""Bisque""/> <ComboBoxItem Content=""Black"" Background=""Black""/> <ComboBoxItem Content=""BlanchedAlmond"" Background=""BlanchedAlmond""/> <ComboBoxItem Content=""Blue"" Background=""Blue""/> <ComboBoxItem Content=""BlueViolet"" Background=""BlueViolet""/> <ComboBoxItem Content=""Brown"" Background=""Brown""/> <ComboBoxItem Content=""BurlyWood"" Background=""BurlyWood""/> <ComboBoxItem Content=""CadetBlue"" Background=""CadetBlue""/> <ComboBoxItem Content=""Chartreuse"" Background=""Chartreuse""/> <ComboBoxItem Content=""Chocolate"" Background=""Chocolate""/> <ComboBoxItem Content=""Coral"" Background=""Coral""/> <ComboBoxItem Content=""CornflowerBlue"" Background=""CornflowerBlue""/> <ComboBoxItem Content=""Cornsilk"" Background=""Cornsilk""/> <ComboBoxItem Content=""Crimson"" Background=""Crimson""/> <ComboBoxItem Content=""Cyan"" Background=""Cyan""/> <ComboBoxItem Content=""DarkBlue"" Background=""DarkBlue""/> <ComboBoxItem Content=""DarkCyan"" Background=""DarkCyan""/> <ComboBoxItem Content=""DarkGoldenrod"" Background=""DarkGoldenrod""/> <ComboBoxItem Content=""DarkGray"" Background=""DarkGray""/> <ComboBoxItem Content=""DarkGreen"" Background=""DarkGreen""/> <ComboBoxItem Content=""DarkKhaki"" Background=""DarkKhaki""/> <ComboBoxItem Content=""DarkMagenta"" Background=""DarkMagenta""/> <ComboBoxItem Content=""DarkOliveGreen"" Background=""DarkOliveGreen""/> <ComboBoxItem Content=""DarkOrange"" Background=""DarkOrange""/> <ComboBoxItem Content=""DarkOrchid"" Background=""DarkOrchid""/> <ComboBoxItem Content=""DarkRed"" Background=""DarkRed""/> <ComboBoxItem Content=""DarkSalmon"" Background=""DarkSalmon""/> <ComboBoxItem Content=""DarkSeaGreen"" Background=""DarkSeaGreen""/> <ComboBoxItem Content=""DarkSlateBlue"" Background=""DarkSlateBlue""/> <ComboBoxItem Content=""DarkSlateGray"" Background=""DarkSlateGray""/> <ComboBoxItem Content=""DarkTurquoise"" Background=""DarkTurquoise""/> <ComboBoxItem Content=""DarkViolet"" Background=""DarkViolet""/> <ComboBoxItem Content=""DeepPink"" Background=""DeepPink""/> <ComboBoxItem Content=""DeepSkyBlue"" Background=""DeepSkyBlue""/> <ComboBoxItem Content=""DimGray"" Background=""DimGray""/> <ComboBoxItem Content=""DodgerBlue"" Background=""DodgerBlue""/> <ComboBoxItem Content=""Firebrick"" Background=""Firebrick""/> <ComboBoxItem Content=""FloralWhite"" Background=""FloralWhite""/> <ComboBoxItem Content=""ForestGreen"" Background=""ForestGreen""/> <ComboBoxItem Content=""Fuchsia"" Background=""Fuchsia""/> <ComboBoxItem Content=""Gainsboro"" Background=""Gainsboro""/> <ComboBoxItem Content=""GhostWhite"" Background=""GhostWhite""/> <ComboBoxItem Content=""Gold"" Background=""Gold""/> <ComboBoxItem Content=""Goldenrod"" Background=""Goldenrod""/> <ComboBoxItem Content=""Gray"" Background=""Gray""/> <ComboBoxItem Content=""Green"" Background=""Green""/> <ComboBoxItem Content=""GreenYellow"" Background=""GreenYellow""/> <ComboBoxItem Content=""Honeydew"" Background=""Honeydew""/> <ComboBoxItem Content=""HotPink"" Background=""HotPink""/> <ComboBoxItem Content=""IndianRed"" Background=""IndianRed""/> <ComboBoxItem Content=""Indigo"" Background=""Indigo""/> <ComboBoxItem Content=""Ivory"" Background=""Ivory""/> <ComboBoxItem Content=""Khaki"" Background=""Khaki""/> <ComboBoxItem Content=""Lavender"" Background=""Lavender""/> <ComboBoxItem Content=""LavenderBlush"" Background=""LavenderBlush""/> <ComboBoxItem Content=""LawnGreen"" Background=""LawnGreen""/> <ComboBoxItem Content=""LemonChiffon"" Background=""LemonChiffon""/> <ComboBoxItem Content=""LightBlue"" Background=""LightBlue""/> <ComboBoxItem Content=""LightCoral"" Background=""LightCoral""/> <ComboBoxItem Content=""LightCyan"" Background=""LightCyan""/> <ComboBoxItem Content=""LightGoldenrodYellow"" Background=""LightGoldenrodYellow""/> <ComboBoxItem Content=""LightGray"" Background=""LightGray""/> <ComboBoxItem Content=""LightGreen"" Background=""LightGreen""/> <ComboBoxItem Content=""LightPink"" Background=""LightPink""/> <ComboBoxItem Content=""LightSalmon"" Background=""LightSalmon""/> <ComboBoxItem Content=""LightSeaGreen"" Background=""LightSeaGreen""/> <ComboBoxItem Content=""LightSkyBlue"" Background=""LightSkyBlue""/> <ComboBoxItem Content=""LightSlateGray"" Background=""LightSlateGray""/> <ComboBoxItem Content=""LightSteelBlue"" Background=""LightSteelBlue""/> <ComboBoxItem Content=""LightYellow"" Background=""LightYellow""/> <ComboBoxItem Content=""Lime"" Background=""Lime""/> <ComboBoxItem Content=""LimeGreen"" Background=""LimeGreen""/> <ComboBoxItem Content=""Linen"" Background=""Linen""/> <ComboBoxItem Content=""Magenta"" Background=""Magenta""/> <ComboBoxItem Content=""Maroon"" Background=""Maroon""/> <ComboBoxItem Content=""MediumAquamarine"" Background=""MediumAquamarine""/> <ComboBoxItem Content=""MediumBlue"" Background=""MediumBlue""/> <ComboBoxItem Content=""MediumOrchid"" Background=""MediumOrchid""/> <ComboBoxItem Content=""MediumPurple"" Background=""MediumPurple""/> <ComboBoxItem Content=""MediumSeaGreen"" Background=""MediumSeaGreen""/> <ComboBoxItem Content=""MediumSlateBlue"" Background=""MediumSlateBlue""/> <ComboBoxItem Content=""MediumSpringGreen"" Background=""MediumSpringGreen""/> <ComboBoxItem Content=""MediumTurquoise"" Background=""MediumTurquoise""/> <ComboBoxItem Content=""MediumVioletRed"" Background=""MediumVioletRed""/> <ComboBoxItem Content=""MidnightBlue"" Background=""MidnightBlue""/> <ComboBoxItem Content=""MintCream"" Background=""MintCream""/> <ComboBoxItem Content=""MistyRose"" Background=""MistyRose""/> <ComboBoxItem Content=""Moccasin"" Background=""Moccasin""/> <ComboBoxItem Content=""NavajoWhite"" Background=""NavajoWhite""/> <ComboBoxItem Content=""Navy"" Background=""Navy""/> <ComboBoxItem Content=""OldLace"" Background=""OldLace""/> <ComboBoxItem Content=""Olive"" Background=""Olive""/> <ComboBoxItem Content=""OliveDrab"" Background=""OliveDrab""/> <ComboBoxItem Content=""Orange"" Background=""Orange""/> <ComboBoxItem Content=""OrangeRed"" Background=""OrangeRed""/> <ComboBoxItem Content=""Orchid"" Background=""Orchid""/> <ComboBoxItem Content=""PaleGoldenrod"" Background=""PaleGoldenrod""/> <ComboBoxItem Content=""PaleGreen"" Background=""PaleGreen""/> <ComboBoxItem Content=""PaleTurquoise"" Background=""PaleTurquoise""/> <ComboBoxItem Content=""PaleVioletRed"" Background=""PaleVioletRed""/> <ComboBoxItem Content=""PapayaWhip"" Background=""PapayaWhip""/> <ComboBoxItem Content=""PeachPuff"" Background=""PeachPuff""/> <ComboBoxItem Content=""Peru"" Background=""Peru""/> <ComboBoxItem Content=""Pink"" Background=""Pink""/> <ComboBoxItem Content=""Plum"" Background=""Plum""/> <ComboBoxItem Content=""PowderBlue"" Background=""PowderBlue""/> <ComboBoxItem Content=""Purple"" Background=""Purple""/> <ComboBoxItem Content=""Red"" Background=""Red""/> <ComboBoxItem Content=""RosyBrown"" Background=""RosyBrown""/> <ComboBoxItem Content=""RoyalBlue"" Background=""RoyalBlue""/> <ComboBoxItem Content=""SaddleBrown"" Background=""SaddleBrown""/> <ComboBoxItem Content=""Salmon"" Background=""Salmon""/> <ComboBoxItem Content=""SandyBrown"" Background=""SandyBrown""/> <ComboBoxItem Content=""SeaGreen"" Background=""SeaGreen""/> <ComboBoxItem Content=""SeaShell"" Background=""SeaShell""/> <ComboBoxItem Content=""Sienna"" Background=""Sienna""/> <ComboBoxItem Content=""Silver"" Background=""Silver""/> <ComboBoxItem Content=""SkyBlue"" Background=""SkyBlue""/> <ComboBoxItem Content=""SlateBlue"" Background=""SlateBlue""/> <ComboBoxItem Content=""SlateGray"" Background=""SlateGray""/> <ComboBoxItem Content=""Snow"" Background=""Snow""/> <ComboBoxItem Content=""SpringGreen"" Background=""SpringGreen""/> <ComboBoxItem Content=""SteelBlue"" Background=""SteelBlue""/> <ComboBoxItem Content=""Tan"" Background=""Tan""/> <ComboBoxItem Content=""Teal"" Background=""Teal""/> <ComboBoxItem Content=""Thistle"" Background=""Thistle""/> <ComboBoxItem Content=""Tomato"" Background=""Tomato""/> <ComboBoxItem Content=""Transparent"" Background=""Transparent""/> <ComboBoxItem Content=""Turquoise"" Background=""Turquoise""/> <ComboBoxItem Content=""Violet"" Background=""Violet""/> <ComboBoxItem Content=""Wheat"" Background=""Wheat""/> <ComboBoxItem Content=""White"" Background=""White""/> <ComboBoxItem Content=""WhiteSmoke"" Background=""WhiteSmoke""/> <ComboBoxItem Content=""Yellow"" Background=""Yellow""/> <ComboBoxItem Content=""YellowGreen"" Background=""YellowGreen""/> </ComboBox>") as ComboBox; foreach (ComboBoxItem item in combo.Items) { ComboBoxItem citem = new ComboBoxItem(); citem.Height = 20; citem.Content = item.Content; citem.Background = item.Background; comboBox.Items.Add(citem); } return(comboBox); }
private static System.Collections.ObjectModel.ObservableCollection<object> Get_cbDifficulty_Items() { System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>(); // e_28 element ComboBoxItem e_28 = new ComboBoxItem(); e_28.Name = "e_28"; e_28.SetResourceReference(ComboBoxItem.ContentProperty, "EasyDifficultyText"); items.Add(e_28); // e_29 element ComboBoxItem e_29 = new ComboBoxItem(); e_29.Name = "e_29"; e_29.SetResourceReference(ComboBoxItem.ContentProperty, "NormalDifficultyText"); items.Add(e_29); // e_30 element ComboBoxItem e_30 = new ComboBoxItem(); e_30.Name = "e_30"; e_30.SetResourceReference(ComboBoxItem.ContentProperty, "HardDifficultyText"); items.Add(e_30); return items; }
private void customApiMethod_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { ComboBox sourceComboBox = e.Source as ComboBox ?? throw new ArgumentException("Custom Api Not Found"); ComboBoxItem selectedItem = (ComboBoxItem)sourceComboBox.SelectedItem; string selectedText = selectedItem.Content.ToString() ?? throw new ArgumentException("Custom Api Not Found"); switch (sourceComboBox.Name) { case "customApiAvailableMethod": Config.LightSettings.CustomApi.CustomApiAvailable.Method = selectedText; break; case "customApiBusyMethod": Config.LightSettings.CustomApi.CustomApiBusy.Method = selectedText; break; case "customApiBeRightBackMethod": Config.LightSettings.CustomApi.CustomApiBeRightBack.Method = selectedText; break; case "customApiAwayMethod": Config.LightSettings.CustomApi.CustomApiAway.Method = selectedText; break; case "customApiDoNotDisturbMethod": Config.LightSettings.CustomApi.CustomApiDoNotDisturb.Method = selectedText; break; case "customApiAvailableIdleMethod": Config.LightSettings.CustomApi.CustomApiAvailableIdle.Method = selectedText; break; case "customApiOfflineMethod": Config.LightSettings.CustomApi.CustomApiOffline.Method = selectedText; break; case "customApiOffMethod": Config.LightSettings.CustomApi.CustomApiOff.Method = selectedText; break; case "customApiActivityAvailableMethod": Config.LightSettings.CustomApi.CustomApiActivityAvailable.Method = selectedText; break; case "customApiActivityPresentingMethod": Config.LightSettings.CustomApi.CustomApiActivityPresenting.Method = selectedText; break; case "customApiActivityInACallMethod": Config.LightSettings.CustomApi.CustomApiActivityInACall.Method = selectedText; break; case "customApiActivityInAConferenceCallMethod": Config.LightSettings.CustomApi.CustomApiActivityInAConferenceCall.Method = selectedText; break; case "customApiActivityInAMeetingMethod": Config.LightSettings.CustomApi.CustomApiActivityInAMeeting.Method = selectedText; break; case "customApiActivityBusyMethod": Config.LightSettings.CustomApi.CustomApiActivityBusy.Method = selectedText; break; case "customApiActivityAwayMethod": Config.LightSettings.CustomApi.CustomApiActivityAway.Method = selectedText; break; case "customApiActivityBeRightBackMethod": Config.LightSettings.CustomApi.CustomApiActivityBeRightBack.Method = selectedText; break; case "customApiActivityDoNotDisturbMethod": Config.LightSettings.CustomApi.CustomApiActivityDoNotDisturb.Method = selectedText; break; case "customApiActivityIdleMethod": Config.LightSettings.CustomApi.CustomApiActivityIdle.Method = selectedText; break; case "customApiActivityOfflineMethod": Config.LightSettings.CustomApi.CustomApiActivityOffline.Method = selectedText; break; case "customApiActivityOffMethod": Config.LightSettings.CustomApi.CustomApiActivityOff.Method = selectedText; break; default: break; } e.Handled = true; }
private static System.Collections.ObjectModel.ObservableCollection<object> Get_cbDisplayMode_Items() { System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>(); // e_40 element ComboBoxItem e_40 = new ComboBoxItem(); e_40.Name = "e_40"; e_40.SetResourceReference(ComboBoxItem.ContentProperty, "FullscreenText"); items.Add(e_40); // e_41 element ComboBoxItem e_41 = new ComboBoxItem(); e_41.Name = "e_41"; e_41.SetResourceReference(ComboBoxItem.ContentProperty, "WindowedText"); items.Add(e_41); // e_42 element ComboBoxItem e_42 = new ComboBoxItem(); e_42.Name = "e_42"; e_42.SetResourceReference(ComboBoxItem.ContentProperty, "BorderlessText"); items.Add(e_42); return items; }
private void loadDesktopBackgroundSettings() { cboDesktopBackgroundType.Items.Clear(); cboWindowsBackgroundStyle.Items.Clear(); cboCairoBackgroundStyle.Items.Clear(); cboBingBackgroundStyle.Items.Clear(); #region windowsDefaultBackground ComboBoxItem windowsDefaultBackgroundItem = new ComboBoxItem() { Name = "windowsDefaultBackground", Content = Localization.DisplayString.sSettings_Desktop_BackgroundType_windowsDefaultBackground, Tag = windowsImageBackgroundStackPanel }; cboDesktopBackgroundType.Items.Add(windowsDefaultBackgroundItem); // draw wallpaper string regWallpaper = Registry.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper", "") as string; string regWallpaperStyle = Registry.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "") as string; string regTileWallpaper = Registry.GetValue(@"HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "") as string; Desktop.CairoWallpaperStyle style = Desktop.CairoWallpaperStyle.Stretch; // https://docs.microsoft.com/en-us/windows/desktop/Controls/themesfileformat-overview switch ($"{regWallpaperStyle}{regTileWallpaper}") { case "01": // Tiled { WallpaperStyle = 0; TileWallpaper = 1 } style = Desktop.CairoWallpaperStyle.Tile; break; case "00": // Centered { WallpaperStyle = 1; TileWallpaper = 0 } style = Desktop.CairoWallpaperStyle.Center; break; case "60": // Fit { WallpaperStyle = 6; TileWallpaper = 0 } style = Desktop.CairoWallpaperStyle.Fit; break; case "100": // Fill { WallpaperStyle = 10; TileWallpaper = 0 } style = Desktop.CairoWallpaperStyle.Fill; break; case "220": // Span { WallpaperStyle = 10; TileWallpaper = 0 } style = Desktop.CairoWallpaperStyle.Span; break; case "20": // Stretched { WallpaperStyle = 2; TileWallpaper = 0 } default: style = Desktop.CairoWallpaperStyle.Stretch; break; } txtWindowsBackgroundPath.Text = regWallpaper; #endregion foreach (var backgroundStyleItem in Enum.GetValues(typeof(Desktop.CairoWallpaperStyle)).Cast <Desktop.CairoWallpaperStyle>()) { string display; switch (backgroundStyleItem) { case Desktop.CairoWallpaperStyle.Center: display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Center; break; case Desktop.CairoWallpaperStyle.Fill: display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Fill; break; case Desktop.CairoWallpaperStyle.Fit: display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Fit; break; case Desktop.CairoWallpaperStyle.Span: display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Span; break; case Desktop.CairoWallpaperStyle.Stretch: display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Stretch; break; case Desktop.CairoWallpaperStyle.Tile: display = Localization.DisplayString.sSettings_Desktop_BackgroundStyle_Tile; break; default: display = backgroundStyleItem.ToString(); break; } // windows ComboBoxItem cboWindowsItem = new ComboBoxItem() { Tag = backgroundStyleItem, Content = display }; cboWindowsBackgroundStyle.Items.Add(cboWindowsItem); if (backgroundStyleItem == style) { cboWindowsItem.IsSelected = true; } if (Shell.IsCairoRunningAsShell) { // image ComboBoxItem cboImageItem = new ComboBoxItem() { Tag = backgroundStyleItem, Content = display }; cboCairoBackgroundStyle.Items.Add(cboImageItem); if (backgroundStyleItem == (Desktop.CairoWallpaperStyle)Settings.Instance.CairoBackgroundImageStyle) { cboImageItem.IsSelected = true; } // bing ComboBoxItem cboBingItem = new ComboBoxItem() { Tag = backgroundStyleItem, Content = display }; cboBingBackgroundStyle.Items.Add(cboBingItem); if (backgroundStyleItem == (Desktop.CairoWallpaperStyle)Settings.Instance.BingWallpaperStyle) { cboBingItem.IsSelected = true; } } } if (Shell.IsCairoRunningAsShell) { #region cairoImageWallpaper ComboBoxItem cairoImageWallpaperItem = new ComboBoxItem() { Name = "cairoImageWallpaper", Content = Localization.DisplayString.sSettings_Desktop_BackgroundType_cairoImageWallpaper, Tag = cairoImageBackgroundStackPanel }; cboDesktopBackgroundType.Items.Add(cairoImageWallpaperItem); txtCairoBackgroundPath.Text = Settings.Instance.CairoBackgroundImagePath; #endregion #region cairoVideoWallpaper ComboBoxItem cairoVideoWallpaperItem = new ComboBoxItem() { Name = "cairoVideoWallpaper", Content = Localization.DisplayString.sSettings_Desktop_BackgroundType_cairoVideoWallpaper, Tag = cairoVideoBackgroundStackPanel }; cboDesktopBackgroundType.Items.Add(cairoVideoWallpaperItem); txtCairoVideoBackgroundPath.Text = Settings.Instance.CairoBackgroundVideoPath; #endregion #region bingWallpaper ComboBoxItem bingWallpaperItem = new ComboBoxItem() { Name = "bingWallpaper", Content = Localization.DisplayString.sSettings_Desktop_BackgroundType_bingWallpaper, Tag = bingImageBackgroundStackPanel }; cboDesktopBackgroundType.Items.Add(bingWallpaperItem); #endregion var listBoxItems = cboDesktopBackgroundType.Items.Cast <ComboBoxItem>().ToList(); var listBoxItem = listBoxItems.FirstOrDefault(l => l.Name == Settings.Instance.DesktopBackgroundType); cboDesktopBackgroundType.SelectedItem = listBoxItem; } else { cboDesktopBackgroundType.SelectedItem = windowsDefaultBackgroundItem; desktopBackgroundTypeStackPanel.Visibility = Visibility.Collapsed; } }
private void Start() { // マネージャコンポ取得 gameManager = GameObject.FindWithTag("GameManager").GetComponent<GameManager>(); // オーディオコンポを取得 audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>(); // TODO 本当はリクワイヤードコンポ属性を使うべき。上手く動いてくれなかったのでとりあえず if (null == audioCompo) audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>(); // プルダウンメニューに追加するボタンを生成 var buttonFire = new ComboBoxItem("Fire", imageFire, false); // 火属性 var buttonWater = new ComboBoxItem("Water", imageWater, false); // 水属性 var buttonEarth = new ComboBoxItem("Earth", imageEarth, false); // 土属性 var buttonWind = new ComboBoxItem("Wind", imageWind, false); // 風属性 // 火属性のプルダウンメニューボタンがクリックされた時の処理 buttonFire.OnSelect += () => { // プルダウンメニューの大きさを変える // comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 180); // comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 40); // すでに選択されているボタンをプルダウンメニューから選択不可に、それ以外を選択可に設定する comboBox.UpdateGraphics(); buttonFire.ClassName = "Fire"; // 火属性 buttonFire.IsDisabled = true; buttonWater.ClassName = "Water"; // 水属性 buttonWater.IsDisabled = false; buttonEarth.ClassName = "Earth"; // 土属性 buttonEarth.IsDisabled = false; buttonWind.ClassName = "Wind"; // 風属性 buttonWind.IsDisabled = false; }; // 水属性のプルダウンメニューボタンがクリックされた時の処理 buttonWater.OnSelect += () => { // すでに選択されているボタンをプルダウンメニューから選択不可に、それ以外を選択可に設定する comboBox.UpdateGraphics(); buttonFire.ClassName = "Fire"; // 火属性 buttonFire.IsDisabled = false; buttonWater.ClassName = "Water"; // 水属性 buttonWater.IsDisabled = true; buttonEarth.ClassName = "Earth"; // 土属性 buttonEarth.IsDisabled = false; buttonWind.ClassName = "Wind"; // 風属性 buttonWind.IsDisabled = false; }; // 土属性のプルダウンメニューボタンがクリックされた時の処理 buttonEarth.OnSelect += () => { // すでに選択されているボタンをプルダウンメニューから選択不可に、それ以外を選択可に設定する comboBox.UpdateGraphics(); buttonFire.ClassName = "Fire"; // 火属性 buttonFire.IsDisabled = false; buttonWater.ClassName = "Water"; // 水属性 buttonWater.IsDisabled = false; buttonEarth.ClassName = "Earth"; // 土属性 buttonEarth.IsDisabled = true; buttonWind.ClassName = "Wind"; // 風属性 buttonWind.IsDisabled = false; }; // 風属性のプルダウンメニューボタンがクリックされた時の処理 buttonWind.OnSelect += () => { // すでに選択されているボタンをプルダウンメニューから選択不可に、それ以外を選択可に設定する comboBox.UpdateGraphics(); buttonFire.ClassName = "Fire"; // 火属性 buttonFire.IsDisabled = false; buttonWater.ClassName = "Water"; // 水属性 buttonWater.IsDisabled = false; buttonEarth.ClassName = "Earth"; // 土属性 buttonEarth.IsDisabled = false; buttonWind.ClassName = "Wind"; // 風属性 buttonWind.IsDisabled = true; }; // 上記の設定内容でアイテムを追加する // ここの追加順序でプルダウンメニュー内ボタンの並び順が決まる comboBox.AddItems(buttonFire, buttonWater, buttonEarth, buttonWind); // 最初に表示されるプルダウンメニューのエレメントを決定 comboBox.SelectedElement = 0; if (!text_UnitID) { // ユニットIDのTextコンポがインスペクタからアタッチされていない場合はワーニング後、終了する Debug.Log("ユニットIDのTextコンポを持つゲームオブジェクトがアタッチされていません。インスペクタより設定して下さい。"); return; } // ユニットIDのTextからユニットIDである最後の1文字(または2文字)を抜き出して定数リテラルに変換する int unitID = 0; if (4 == text_UnitID.text.Length) { // IDが1桁の場合は末尾1文字を抽出 unitID = int.Parse(text_UnitID.text.Substring(text_UnitID.text.Length - 1, 1)); } else { // IDが2桁の場合は末尾2文字を抽出 unitID = int.Parse(text_UnitID.text.Substring(text_UnitID.text.Length - 2, 2)); } // TextコンポのID文字列とユニットリスト内のID値の差分を補正 unitID = unitID - 1; // 最初に表示されるプルダウンメニューのクラスを決定 comboBox.SelectedElement = gameManager.unitStateList[unitID].element-1; // プルダウンメニューから何れかのボタンをクリックしSelectedClassフィールドが変更された時の処理 comboBox.OnSelectionChanged += (int index) => { // SEを鳴らす clickSE = (AudioClip)Resources.Load("Sounds/SE/Click4"); audioCompo.PlayOneShot(clickSE); }; }
/// <summary> /// Updates the Register list. /// </summary> internal void SyncRegisters() { registers = new ObservableCollection<RegisterItem>(); registers_final = new ObservableCollection<RegisterItem>(); ComboBoxItem ci = (ComboBoxItem)ItemsPerPage.SelectedItem; int itemsPerPage = Convert.ToInt32(ci.Content); int page = 1; int count = 0; dbman = new DBConnectionManager(); using (conn = new MySqlConnection(dbman.GetConnStr())) { conn.Open(); if (conn.State == ConnectionState.Open) { MySqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM registers;"; MySqlDataReader db_reader = cmd.ExecuteReader(); while (db_reader.Read()) { int bookNum = Convert.ToInt32(db_reader.GetString("book_number")); RegisterItem ri = new RegisterItem(); if (db_reader.GetString("status") == "Archived") { ri.RegIcon.Kind = MahApps.Metro.IconPacks.PackIconFontAwesomeKind.ArchiveSolid; ri.RegIcon.ToolTip = "This register is archived."; } ri.BookTypeHolder.Content = db_reader.GetString("book_type"); ri.BookNoHolder.Content = "Book #" + db_reader.GetString("book_number"); ri.BookContentStatHolder.Content = CountEntries(Convert.ToInt32(db_reader.GetString("book_number"))) + " Entries | " + CountPages(Convert.ToInt32(db_reader.GetString("book_number"))) + " Pages"; ri.ViewRegisterButton.Click += (sender, e) => { ViewRegister_Click(sender, e, bookNum); }; ri.EditRegisterButton.Click += (sender, e) => { EditRegister_Click(sender, e, bookNum); }; ri.AccessFrequency.Content = "Access Frequency: " + CheckFrequency(bookNum); if (CheckFrequency(bookNum) == "Very Low") { ri.AccessFrequency.Foreground = Brushes.OrangeRed; } else if (CheckFrequency(bookNum) == "Low") { ri.AccessFrequency.Foreground = Brushes.Orange; } else if (CheckFrequency(bookNum) == "Moderate") { ri.AccessFrequency.Foreground = Brushes.ForestGreen; } else if (CheckFrequency(bookNum) == "High") { ri.AccessFrequency.Foreground = Brushes.DeepSkyBlue; } ri.Page.Content = page; registers.Add(ri); count++; if (count == itemsPerPage) { page++; count = 0; } } foreach (var cur in registers) { if (Convert.ToInt32(cur.Page.Content) == CurrentPage.Value) { registers_final.Add(cur); } } //close Connection conn.Close(); RegistersItemContainer.Items.Refresh(); RegistersItemContainer.ItemsSource = registers_final; RegistersItemContainer.Items.Refresh(); CurrentPage.Maximum = page; } else { } } }
private void Type_Box_SelectionChanged(object sender, SelectionChangedEventArgs e) { Table.Items.Clear(); while (Table.Columns.Count > 0) { Table.Columns.RemoveAt(0); } ComboBoxItem item = (ComboBoxItem)Type_Box.SelectedItem; string type = item.Content.ToString(); if (type == "Boundary SPC") { DataGridTextColumn NID_Column = new DataGridTextColumn { Header = "Node ID", Binding = new Binding("NID"), Width = GridColWidth }; DataGridTextColumn X_Column = new DataGridTextColumn { Header = "Fix X", Binding = new Binding("X"), Width = GridColWidth }; DataGridTextColumn Y_Column = new DataGridTextColumn { Header = "Fix Y", Binding = new Binding("Y"), Width = GridColWidth }; DataGridTextColumn Z_Column = new DataGridTextColumn { Header = "Fix Z", Binding = new Binding("Z"), Width = GridColWidth }; Table.Columns.Add(NID_Column); Table.Columns.Add(X_Column); Table.Columns.Add(Y_Column); Table.Columns.Add(Z_Column); Table.Items.Add(new SPC_Row { NID = 0, X = 0, Y = 0, Z = 0 }); // Disable Value TextBox XValue.IsEnabled = false; YValue.IsEnabled = false; ZValue.IsEnabled = false; } if (type == "Point load") { DataGridTextColumn NID_Column = new DataGridTextColumn { Header = "Node ID", Binding = new Binding("NID"), Width = GridColWidth }; DataGridTextColumn X_Column = new DataGridTextColumn { Header = "Force X", Binding = new Binding("X"), Width = GridColWidth }; DataGridTextColumn Y_Column = new DataGridTextColumn { Header = "Force Y", Binding = new Binding("Y"), Width = GridColWidth }; DataGridTextColumn Z_Column = new DataGridTextColumn { Header = "Force Z", Binding = new Binding("Z"), Width = GridColWidth }; Table.Columns.Add(NID_Column); Table.Columns.Add(X_Column); Table.Columns.Add(Y_Column); Table.Columns.Add(Z_Column); Table.Items.Add(new SPC_Row { NID = 0, X = 0, Y = 0, Z = 0 }); } // Enable Value TextBox XValue.IsEnabled = true; YValue.IsEnabled = true; ZValue.IsEnabled = true; }
private void show_weather_Click(object sender, RoutedEventArgs e) { fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet"))); fcb_public.publicDataSetTableAdapters.weatherTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.weatherTableAdapter(); if (in_nameTextBox.Text != "") { ComboBoxItem item = gmt.SelectedItem as ComboBoxItem; float gmtime = 0; //string str = item.Content.ToString(); //switch (str) //{ // case "UTC": // gmtime = 0; // break; // case"UTC+00:30": // gmtime = 0.5f; // break; // case "UTC+01:00": // gmtime = 1f; // break; // case "UTC+01:30": // gmtime = 1.5f; // break; // case "UTC+02:00": // gmtime = 2f; // break; // case "UTC+02:30": // gmtime = 2.5f; // break; // case "UTC+03:00": // gmtime = 3f; // break; // case "UTC+03:30": // gmtime = 3.5f; // break; // case "UTC+04:00": // gmtime = 4f; // break; // case "UTC+04:30": // gmtime = 4.5f; // break; // case "UTC+05:00": // gmtime = 5f; // break; // case "UTC+05:30": // gmtime = 5.5f; // break; // case "UTC+06:00": // gmtime = 6f; // break; // case "UTC+06:30": // gmtime = 6.5f; // break; // case "UTC+07:00": // gmtime = 7f; // break; // case "UTC+07:30": // gmtime = 7.5f; // break; // case "UTC+08:00": // gmtime = 8f; // break; // case "UTC+08:30": // gmtime = 8.5f; // break; // case "UTC+09:00": // gmtime = 9.5f; // break; // case "UTC+10:00": // gmtime = 10f; // break; // case "UTC+10:30": // gmtime = 10.5f; // break; // case "UTC+11:00": // gmtime = 11f; // break; // case "UTC+11:30": // gmtime = 11.5f; // break; // case "UTC+12:00": // gmtime = 12f; // break; // case "UTC-00:30": // gmtime = -0.5f; // break; // case "UTC-01:00": // gmtime = -1f; // break; // case "UTC-01:30": // gmtime = -1.5f; // break; // case "UTC-02:00": // gmtime = -2f; // break; // case "UTC-02:30": // gmtime = -2.5f; // break; // case "UTC-03:00": // gmtime = -3f; // break; // case "UTC-03:30": // gmtime = -3.5f; // break; // case "UTC-04:00": // gmtime = -4f; // break; // case "UTC-04:30": // gmtime = -4.5f; // break; // case "UTC-05:00": // gmtime = -5f; // break; // case "UTC-05:30": // gmtime = -5.5f; // break; // case "UTC-06:00": // gmtime = -6f; // break; // case "UTC-06:30": // gmtime = -6.5f; // break; // case "UTC-07:00": // gmtime = -7f; // break; // case "UTC-07:30": // gmtime = -7.5f; // break; // case "UTC-08:00": // gmtime = -8f; // break; // case "UTC-08:30": // gmtime = -8.5f; // break; // case "UTC-09:00": // gmtime = -9.5f; // break; // case "UTC-10:00": // gmtime = -10f; // break; // case "UTC-10:30": // gmtime = -10.5f; // break; // case "UTC-11:00": // gmtime = -11f; // break; // case "UTC-11:30": // gmtime = -11.5f; // break; // case "UTC-12:00": // gmtime = -12f; // break; //} publicDataSet.weather.AddweatherRow((int)(SystemParameters.PrimaryScreenWidth - 300), 70, in_nameTextBox.Text, (bool)statusCheckBox.IsChecked, gmtime); publicDataSetInitializeTableAdapter.Update(publicDataSet.weather); publicDataSetInitializeTableAdapter.Fill(publicDataSet.weather); // PublicClass.city_name = in_nameTextBox.Text.Trim(); publicDataSet.AcceptChanges(); PublicClass.show = "showweather"; } }
public void BindCaiJiTypeData() { ComboBoxItem cbi1 = new ComboBoxItem(); cbi1.Text = "国内代理"; cbi1.Value = "1"; cbx_caijitype.Items.Add(cbi1); ComboBoxItem cbi2 = new ComboBoxItem(); cbi2.Text = "国外代理"; cbi2.Value = "2"; cbx_caijitype.Items.Add(cbi2); cbx_caijitype.SelectedIndex = 0; }
private void SelectImportFileButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); if (openFileDialog.ShowDialog() == true) { _SelectedFileFullPath = openFileDialog.FileName; SelectedFileLabel.Content = (new FileInfo(openFileDialog.FileName)).Name; } else { return; } SLExcelReader reader = new SLExcelReader(); SLExcelData excelData = reader.ReadExcel(_SelectedFileFullPath); SiteSetting siteSetting = ApplicationContext.Current.Configuration.SiteSettings[_MainObject.SiteSettingID]; List <Field> fields = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType).GetFields(siteSetting, _MainObject); DynamicGrid.ColumnDefinitions.Clear(); ColumnDefinition gridCol1 = new ColumnDefinition(); ColumnDefinition gridCol2 = new ColumnDefinition(); gridCol1.Width = GridLength.Auto; gridCol2.Width = GridLength.Auto; DynamicGrid.ColumnDefinitions.Add(gridCol1); DynamicGrid.ColumnDefinitions.Add(gridCol2); for (int i = 0; i < excelData.Headers.Count; i++) { string headerTitle = excelData.Headers[i]; RowDefinition gridRow1 = new RowDefinition(); gridRow1.Height = new GridLength(45); DynamicGrid.RowDefinitions.Add(gridRow1); System.Windows.Controls.ComboBox comboBox = new ComboBox(); comboBox.Width = 200; comboBox.Height = 30; comboBox.Background = Brushes.LightBlue; ComboBoxItem emptycboxitem = new ComboBoxItem(); emptycboxitem.Content = "Select a field"; emptycboxitem.IsSelected = true; emptycboxitem.Tag = ""; comboBox.Items.Add(emptycboxitem); foreach (Field field in fields) { ComboBoxItem cboxitem = new ComboBoxItem(); cboxitem.Content = field.DisplayName; cboxitem.Tag = field.Name; if (field.Name.Equals(headerTitle, StringComparison.InvariantCultureIgnoreCase) == true) { cboxitem.IsSelected = true; } comboBox.Tag = headerTitle; comboBox.Items.Add(cboxitem); } Grid.SetRow(comboBox, i); Grid.SetColumn(comboBox, 1); DynamicGrid.Children.Add(comboBox); Label label = new Label(); label.Content = headerTitle; Grid.SetRow(label, i); Grid.SetColumn(label, 0); DynamicGrid.Children.Add(label); } }