public MainForm() { InitializeComponent(); ControlExtensions.SetDoubleBuffered(calendarControl); workersList.Focus(); ClearData(); }
// 初始化.cs文件中的数据绑定,一些不方便在xaml中绑定的部分在这里绑定 private void init_binding() { // 绑定结点颜色枚举 ComboBox color_ComboBox = ControlExtensions.FindControl <ComboBox>(this, "color_ComboBox"); color_ComboBox.Items = TopoNode.NodeColors; }
private void init_event() { // 锁头按下时反转IsLock属性 Lock lockShape = ControlExtensions.FindControl <Lock>(this, "lockShape"); lockShape.Tapped += reverseIsLock; }
private void LoadTopSearches() { try { Program.log.Info("Getting most searches"); BackGroundWorker.RunWorkAsync <List <string> >(() => GetTopSearches(), (data) => { if (this.InvokeRequired) { Invoke(new LoadTopSearchesCallBack(LoadTopSearches), new object[] { }); } else { int count = 0; foreach (var tag in data) { if (count <= 100) { flowPanelMostSearches.Controls.Add(ControlExtensions.GetMostSearchTag(tag, count)); count++; } } Program.log.Info("Most searches returned successfully"); } }); } catch (Exception ex) { labelMostSearches.Visible = false; flowPanelMostSearches.Visible = false; Program.log.Error("Error getting top searches", ex); } /* Error occurred, so hide controls/skip... */ }
private static string GetFileUrlPrefix(string fileSystemName, bool isDownload) { var routeName = isDownload ? "VfsFileDownloadUrl" : "VfsFileUrl"; if (RouteTable.Routes[routeName] != null) { var virtualPath = ControlExtensions.GetRouteUrl(routeName, new Hashtable() { { "filesystem", fileSystemName } }); if (virtualPath == null) { throw new Exception("Invalid configuration for route " + routeName); } var basePath = VirtualPathUtility.AppendTrailingSlash(WebManager.BasePath); if (virtualPath.StartsWith(basePath)) { virtualPath = virtualPath.Substring(basePath.Length); } int paramStart = virtualPath.IndexOf('?'); return((paramStart >= 0 ? virtualPath.Substring(0, paramStart) : virtualPath) + "?"); } return(isDownload ? String.Format("FileTreeAjaxHandler.axd?filesystem={0}&action=download&file=", fileSystemName) : String.Format("FileTreeAjaxHandler.axd?filesystem={0}&file=", fileSystemName)); }
public void Update_ZDMethod() { ListBox method_ZD_ListBox = ControlExtensions.FindControl <ListBox>(this, "method_ZD_ListBox"); if (method_ZD_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定要更新的Method!"; return; } ComboBox returnType_ComboBox = ControlExtensions.FindControl <ComboBox>(this, "returnType_ComboBox"); if (returnType_ComboBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定自定Method的返回类型!"; return; } TextBox methodName_TextBox = ControlExtensions.FindControl <TextBox>(this, "methodName_TextBox"); if (methodName_TextBox.Text == null || methodName_TextBox.Text.Length == 0) { ResourceManager.mainWindowVM.Tips = "需要给出自定Method的方法名!"; return; } ObservableCollection <Attribute> parameters = ((Process_EW_VM)DataContext).ZDParams; if (parameters.Count == 0) { ResourceManager.mainWindowVM.Tips = "至少要在形参表中添加一个参数!"; return; } Method method = (Method)method_ZD_ListBox.SelectedItem; if (methodName_TextBox.Text != method.Name && Checker.Process_Contain_PropName(VM.Process, methodName_TextBox.Text)) { ResourceManager.mainWindowVM.Tips = "标识符重复!"; return; } method.ReturnType = (Type)returnType_ComboBox.SelectedItem; method.Name = methodName_TextBox.Text; method.Parameters = parameters; method.CryptoSuffix = Crypto.None; ResourceManager.mainWindowVM.Tips = "更新了自定Method:" + method; // 更新完成后,要将临时参数列表拿掉,这样再向临时参数列表中添加/更新内容也不会影响刚刚添加的Method // ((Process_EW_VM)DataContext).ZDParams = new ObservableCollection<Attribute>(); // 【11月10日bugfix】更新完成后,将这个临时参数表复制一份保留 ObservableCollection <Attribute> tmp = new ObservableCollection <Attribute>(); foreach (Attribute attribute in ((Process_EW_VM)DataContext).ZDParams) { tmp.Add(new Attribute(attribute)); } ((Process_EW_VM)DataContext).ZDParams = tmp; }
public void Update_Confidential() { ListBox confidential_ListBox = ControlExtensions.FindControl <ListBox>(this, "confidential_ListBox"); if (confidential_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定要修改的Confidential!"; return; } ListBox process_Con_ListBox = ControlExtensions.FindControl <ListBox>(this, "process_Con_ListBox"); if (process_Con_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定Process!"; return; } ListBox attribute_Con_ListBox = ControlExtensions.FindControl <ListBox>(this, "attribute_Con_ListBox"); if (attribute_Con_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定Attribute!"; return; } Confidential confidential = (Confidential)confidential_ListBox.SelectedItem; confidential.Process = (Process)process_Con_ListBox.SelectedItem; confidential.Attribute = (Attribute)attribute_Con_ListBox.SelectedItem; ResourceManager.mainWindowVM.Tips = "修改了Confidential:" + confidential; }
public void Update_Formula() { ListBox axiom_ListBox = ControlExtensions.FindControl <ListBox>(this, "axiom_ListBox"); if (axiom_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定要更新的公理公式!"; return; } TextBox axiom_TextBox = ControlExtensions.FindControl <TextBox>(this, "axiom_TextBox"); if (axiom_TextBox.Text == null || axiom_TextBox.Text.Length == 0) { ResourceManager.mainWindowVM.Tips = "需要给出修改后的公理公式!"; return; } ObservableCollection <Formula> formulas = ((Axiom_EW_VM)DataContext).Axiom.Formulas; // 判重 foreach (Formula formu in formulas) { if (formu.Content == axiom_TextBox.Text) { ResourceManager.mainWindowVM.Tips = "无效的操作。该公理公式已经添加过"; return; } } Formula formula = (Formula)axiom_ListBox.SelectedItem; formula.Content = axiom_TextBox.Text; ResourceManager.mainWindowVM.Tips = "更新了公理公式:" + formula.Content; }
private void init_binding() { // 绑定Axiom的内置公理公式 ListBox innerFormula_ListBox = ControlExtensions.FindControl <ListBox>(this, "innerFormula_ListBox"); innerFormula_ListBox.Items = Axiom.InnerFormulas; }
public void Update_Attribute() { ListBox attr_ListBox = ControlExtensions.FindControl <ListBox>(this, "attr_ListBox"); if (attr_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定要修改的Attribute!"; return; } ListBox type_ListBox = ControlExtensions.FindControl <ListBox>(this, "type_ListBox"); if (type_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定成员类型!"; return; } TextBox attrId_TextBox = ControlExtensions.FindControl <TextBox>(this, "attrId_TextBox"); if (attrId_TextBox.Text == null || attrId_TextBox.Text.Length == 0) { ResourceManager.mainWindowVM.Tips = "需要给出成员名称!"; return; } // todo 变量名判重 Attribute attribute = ((Attribute)attr_ListBox.SelectedItem); attribute.Type = (sbid._M.Type)type_ListBox.SelectedItem; attribute.Identifier = attrId_TextBox.Text; ResourceManager.mainWindowVM.Tips = "为进程模板[" + ((Process_EW_VM)DataContext).Process.Name + "]更新了成员变量:" + attribute; }
public void Add_Formula() { TextBox axiom_TextBox = ControlExtensions.FindControl <TextBox>(this, "axiom_TextBox"); if (axiom_TextBox.Text == null || axiom_TextBox.Text.Length == 0) { ResourceManager.mainWindowVM.Tips = "需要给出要添加的公理公式!"; return; } ObservableCollection <Formula> formulas = ((Axiom_EW_VM)DataContext).Axiom.Formulas; // 判重 foreach (Formula formu in formulas) { if (formu.Content == axiom_TextBox.Text) { ResourceManager.mainWindowVM.Tips = "无效的操作。该公理公式已经添加过"; return; } } Formula formula = new Formula(axiom_TextBox.Text); formulas.Add(formula); ResourceManager.mainWindowVM.Tips = "添加了公理公式:" + formula.Content; }
public void Update_CommParam() { ListBox param_Comm_ListBox = ControlExtensions.FindControl <ListBox>(this, "param_Comm_ListBox"); if (param_Comm_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要在临时参数列表中选定要修改的参数!"; return; } ComboBox paramType_Comm_ComboBox = ControlExtensions.FindControl <ComboBox>(this, "paramType_Comm_ComboBox"); if (paramType_Comm_ComboBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定参数类型!"; return; } TextBox paramName_Comm_TextBox = ControlExtensions.FindControl <TextBox>(this, "paramName_Comm_TextBox"); if (paramName_Comm_TextBox.Text == null || paramName_Comm_TextBox.Text.Length == 0) { ResourceManager.mainWindowVM.Tips = "需要提供参数名称!"; return; } Attribute attribute = (Attribute)param_Comm_ListBox.SelectedItem; attribute.Type = (Type)paramType_Comm_ComboBox.SelectedItem; attribute.Identifier = paramName_Comm_TextBox.Text; ResourceManager.mainWindowVM.Tips = "已在临时参数列表中更新参数:" + attribute; }
public void Add_Attribute() { ListBox type_ListBox = ControlExtensions.FindControl <ListBox>(this, "type_ListBox"); if (type_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定成员类型!"; return; } TextBox attrId_TextBox = ControlExtensions.FindControl <TextBox>(this, "attrId_TextBox"); if (attrId_TextBox.Text == null || attrId_TextBox.Text.Length == 0) { ResourceManager.mainWindowVM.Tips = "需要给出成员名称!"; return; } // todo 变量名判重 Attribute attribute = new Attribute((sbid._M.Type)type_ListBox.SelectedItem, attrId_TextBox.Text); ((Process_EW_VM)DataContext).Process.Attributes.Add(attribute); ResourceManager.mainWindowVM.Tips = "为进程模板[" + ((Process_EW_VM)DataContext).Process.Name + "]添加了成员变量:" + attribute; }
public void Add_NZMethod() { ListBox innerMethod_ListBox = ControlExtensions.FindControl <ListBox>(this, "innerMethod_ListBox"); if (innerMethod_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定内置方法!"; return; } ComboBox crypto_ComboBox = ControlExtensions.FindControl <ComboBox>(this, "crypto_ComboBox"); if (crypto_ComboBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定加密算法!"; return; } // todo 方法判重 Method method_template = (Method)innerMethod_ListBox.SelectedItem; // 形参表要拷贝一份,以防止在自定Method中对其修改时影响到内置Method ObservableCollection <Attribute> paramerters = new ObservableCollection <Attribute>(); foreach (Attribute attribute in method_template.Parameters) { paramerters.Add(new Attribute(attribute.Type, attribute.Identifier)); } // 这里加密方法要用用户选中的,而不是内置方法模板里的None Method method = new Method(method_template.ReturnType, method_template.Name, paramerters, (Crypto)crypto_ComboBox.SelectedItem); ((Process_EW_VM)DataContext).Process.Methods.Add(method); ResourceManager.mainWindowVM.Tips = "为进程模板[" + ((Process_EW_VM)DataContext).Process.Name + "]添加了成员方法:" + method; }
public void Delete_Attribute() { ListBox attr_ListBox = ControlExtensions.FindControl <ListBox>(this, "attr_ListBox"); if (attr_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定要删除的Attribute!"; return; } // 获取要删除的Attribute对象 Attribute attribute = (Attribute)attr_ListBox.SelectedItem; // 判断并删除Authenticity bool del_auth = attribute.Type is UserType?JudgeAndDeleteAuthenticity((UserType)attribute.Type, null) : false; ((Process_EW_VM)DataContext).Process.Attributes.Remove(attribute); ResourceManager.mainWindowVM.Tips = "为进程模板[" + ((Process_EW_VM)DataContext).Process.RefName + "]删除了成员变量:" + attribute + "。"; // Tips补充 if (del_auth) { ResourceManager.mainWindowVM.Tips += "[!]因UserType被修改,SecurityProperty中依赖于它的Authenticity的二级属性失配,被一同删除。"; } }
public ActionResult Index(string id) { var formCollection = new FormCollection(Request.QueryString); ViewBag.Id = id; var taskType = formCollection["AssemblyQualifiedTypeName"]; ViewBag.TaskType = taskType; var task = TheTaskFactory.CreateTask(taskType); var ui = TheWorkflowEntityUiResolver.Resolve(task); var values = new Dictionary <string, object>(); foreach (var prop in ui.UiProperties) { values[prop.PropertyName] = ControlExtensions.ControlValue(prop.RenderControl, formCollection[prop.PropertyName]); } if (values.ContainsKey("Id")) { values["Id"] = new Guid((string)values["Id"]); } TheHelper.SetProperties(task, values); ViewBag.PropertiesJson = TheHelper.JsSerializer.Serialize(values); return(View(ui.Render(task))); }
// 初始化.cs文件中的数据绑定,一些不方便在xaml中绑定的部分在这里绑定 private void init_binding() { // 绑定Method的内置方法 ListBox innerMethod_ListBox = ControlExtensions.FindControl <ListBox>(this, "innerMethod_ListBox"); innerMethod_ListBox.Items = Method.InnerMethods; // 绑定内置Method的加密算法枚举 ComboBox crypto_ComboBox = ControlExtensions.FindControl <ComboBox>(this, "crypto_ComboBox"); crypto_ComboBox.Items = System.Enum.GetValues(typeof(Crypto)); crypto_ComboBox.SelectedItem = Crypto.None; // 绑定CommMethod的InOut枚举 ComboBox inout_ComboBox = ControlExtensions.FindControl <ComboBox>(this, "inout_ComboBox"); inout_ComboBox.Items = System.Enum.GetValues(typeof(InOut)); inout_ComboBox.SelectedItem = InOut.In; // 绑定CommMethod的CommWay枚举 ComboBox commWay_ComboBox = ControlExtensions.FindControl <ComboBox>(this, "commWay_ComboBox"); commWay_ComboBox.Items = System.Enum.GetValues(typeof(CommWay)); commWay_ComboBox.SelectedItem = CommWay.NativeEthernetFrame; }
private void tab_SelectedIndexChanged(object sender, EventArgs e) { // Sets current tab and selects appropriate tab title if (tab.SelectedTab == tabHome) { CurrentTab = tabHome; ControlExtensions.SelectTabTitle(titleHome); } else if (tab.SelectedTab == tabSearch) { CurrentTab = tabSearch; ControlExtensions.SelectTabTitle(titleSearch); } else if (tab.SelectedTab == tabDiscover) { CurrentTab = tabDiscover; ControlExtensions.SelectTabTitle(titleDiscover); ShowHosts(); } else if (tab.SelectedTab == tabSubmit) { CurrentTab = tabDiscover; ControlExtensions.SelectTabTitle(titleSubmit); } else if (tab.SelectedTab == tabSettings) { CurrentTab = tabSettings; ControlExtensions.SelectTabTitle(titleSettings); LoadUserSettings(); } else if (tab.SelectedTab == tabInformation) { CurrentTab = tabInformation; ControlExtensions.SelectTabTitle(titleInformation); tabBlank.Controls.Clear(); } }
// 初始化.cs文件中的事件处理方法,一些无法在xaml中绑定的部分在这里绑定 private void init_event() { // 绑定自定Method右侧列表选中项变化的处理方法 ListBox method_ZD_ListBox = ControlExtensions.FindControl <ListBox>(this, nameof(method_ZD_ListBox)); method_ZD_ListBox.SelectionChanged += method_ZD_ListBox_Changed; // 发生点击的处理方法 method_ZD_ListBox.Tapped += Utils.ListBox_Tapped; // 绑定CommMethod右侧列表选中项变化的处理方法 ListBox commMethod_ListBox = ControlExtensions.FindControl <ListBox>(this, nameof(commMethod_ListBox)); commMethod_ListBox.SelectionChanged += commMethod_ListBox_Changed; // 发生点击的处理方法 commMethod_ListBox.Tapped += Utils.ListBox_Tapped; // 绑定内置Method列表选中项变化的处理方法 ListBox innerMethod_ListBox = ControlExtensions.FindControl <ListBox>(this, nameof(innerMethod_ListBox)); innerMethod_ListBox.SelectionChanged += innerMethod_ListBox_Changed; // 发生点击的处理方法 innerMethod_ListBox.Tapped += Utils.ListBox_Tapped; // 绑定CommMethod的CommWay选中项变化的处理方法 ComboBox commWay_ComboBox = ControlExtensions.FindControl <ComboBox>(this, nameof(commWay_ComboBox)); commWay_ComboBox.SelectionChanged += commWay_ComboBox_Changed; }
} = new ShortcutsWindow(); // Keyboard Shortcuts Window (one instance) public MainForm() { Program.log.Info("Initializing"); // Combines all supported file types into one array Types.All.AddRange(Types.Video); Types.All.AddRange(Types.Audio); Types.All.AddRange(Types.Books); Types.All.AddRange(Types.Subtitle); Types.All.AddRange(Types.Torrent); Types.All.AddRange(Types.Software); Types.All.AddRange(Types.Other); SelectedFilesType = Types.All; // Set selected files type to All InitializeComponent(); // Initialize Form = this; // Set this instance labelChangeLog.Text = String.Format(labelChangeLog.Text, Application.ProductVersion); // Set this version on Change Log label in the About tab // Show Splash Screen Controls.Add(FrmSplashScreen); FrmSplashScreen.Dock = DockStyle.Fill; FrmSplashScreen.Location = new Point(0, 0); FrmSplashScreen.ClientSize = ClientSize; FrmSplashScreen.BringToFront(); FrmSplashScreen.Show(); comboBoxSearchHome.DropDownWidth = ControlExtensions.DropDownWidth(comboBoxSearchHome); // Set home search button combobox to fit its contents comboBoxSortFiles.DropDownWidth = ControlExtensions.DropDownWidth(comboBoxSortFiles); // Set files sort combobox to fit its contents Program.log.Info("Initialized"); }
protected void Page_Init(object sender, EventArgs e) { if (PublicCustomerInfos == null) { var loginLinkButton = (HtmlAnchor)ControlExtensions.FindControlRecursive(Master, "LoginLinkButton"); loginLinkButton.Visible = false; Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery))); } _customerCredits = _crRepository.GetById(PublicCustomerInfos.CustomerId); if (!IsPostBack) { if (_customerCredits == null) { SendToFriendButton.Text = "Add"; } ReferralCodeLit.Text = _customerCredits != null ? _customerCredits.ReferralCode : "N/A"; TotalCreditLit.Text = Helper.FormatPrice(_customerCredits != null ? _customerCredits.Amount : 0); EnjoyFreeDayCationLit.Text = string.Format(ErrorMessage.EnjoyDayCations, Helper.FormatPrice(_customerCredits != null ? _customerCredits.FirstRewardForOwner : 0), Helper.FormatPrice(_customerCredits != null ? _customerCredits.FirstRewardForOwner : 0)); RebindLogs(); } }
/// <summary> /// Sets current tab and selects appropriate tab title /// </summary> private void tab_SelectedIndexChanged(object sender, EventArgs e) { if (tab.SelectedTab == tabHome) { ControlExtensions.SelectTabTitle(titleHome); } else if (tab.SelectedTab == tabSearch) { ControlExtensions.SelectTabTitle(titleSearch); } else if (tab.SelectedTab == tabDiscover) { ControlExtensions.SelectTabTitle(titleDiscover); } else if (tab.SelectedTab == tabSubmit) { ControlExtensions.SelectTabTitle(titleSubmit); } else if (tab.SelectedTab == tabSettings) { ControlExtensions.SelectTabTitle(titleSettings); LoadUserSettings(); } else if (tab.SelectedTab == tabInformation) { ControlExtensions.SelectTabTitle(titleInformation); } CurrentTab = tab.SelectedTab; }
private void LoadMostSearches() { try { ExceptionEvents.RetryOnException(3, TimeSpan.FromSeconds(2), () => { Program.Log.Info("Loading most searches"); BackGroundWorker.RunWorkAsync <List <string> >(() => GetMostSearches(), (data) => { if (InvokeRequired) { Invoke(new LoadMostSearchesCallBack(LoadMostSearches), new object[] { }); } else { int count = 0; foreach (var tag in data) { if (count <= 100) { FlowPanelMostSearches.Controls.Add(ControlExtensions.LabelMostSearch(tag, count)); } } count++; Program.Log.Info("Loaded most searches"); } }); }); } catch (Exception ex) { LabelMostSearches.Visible = false; FlowPanelMostSearches.Visible = false; Program.Log.Error("Unable to get most searches", ex); } // Error occurred, so hide controls and skip... }
public MainForm() { Program.log.Info("Initializing"); // Adds all file types to one list Types.All.AddRange(Types.Video); Types.All.AddRange(Types.Audio); Types.All.AddRange(Types.Books); Types.All.AddRange(Types.Subtitle); Types.All.AddRange(Types.Torrent); Types.All.AddRange(Types.Software); Types.All.AddRange(Types.Other); // Set selected files type to All SelectedFilesType = Types.All; // Initialize InitializeComponent(); // Set this instance Form = this; // Show Splash Screen Controls.Add(FrmSplashScreen); FrmSplashScreen.Dock = DockStyle.Fill; FrmSplashScreen.BringToFront(); FrmSplashScreen.Show(); // Set this version on Change Log label in the About tab labelChangeLog.Text = String.Format(labelChangeLog.Text, Application.ProductVersion); // Set static combo dropdown width to max items size comboBoxSearchHome.DropDownWidth = ControlExtensions.GetMaxDropDownWidth(comboBoxSearchHome); comboBoxSortFiles.DropDownWidth = ControlExtensions.GetMaxDropDownWidth(comboBoxSortFiles); Program.log.Info("Initialized"); }
private void OnVlcStopped(object sender, Core.VlcMediaPlayerStoppedEventArgs e) { #if !NET20 myLblState.InvokeIfRequired(l => l.Text = "Stopped"); myCbxAspectRatio.InvokeIfRequired(c => { c.Text = string.Empty; c.Enabled = false; }); #else ControlExtensions.InvokeIfRequired(myLblState, c => c.Text = "Stopped"); ControlExtensions.InvokeIfRequired(myCbxAspectRatio, c => { c.Text = string.Empty; c.Enabled = false; }); #endif ControlExtensions.InvokeIfRequired(myLblAudioCodec, c => c.Text = "Codec: "); ControlExtensions.InvokeIfRequired(myLblAudioChannels, c => c.Text = "Channels: "); ControlExtensions.InvokeIfRequired(myLblAudioRate, c => c.Text = "Rate: "); ControlExtensions.InvokeIfRequired(myLblVideoCodec, c => c.Text = "Codec: "); ControlExtensions.InvokeIfRequired(myLblVideoHeight, c => c.Text = "Height: "); ControlExtensions.InvokeIfRequired(myLblVideoWidth, c => c.Text = "Width: "); }
private void consoleOutputTextBox_TextChanged(object sender, EventArgs e) { ControlExtensions.Suspend(consoleOutputTextBox); consoleOutputTextBox.SelectionStart = consoleOutputTextBox.Text.Length; consoleOutputTextBox.ScrollToCaret(); ControlExtensions.Resume(consoleOutputTextBox); }
// 初始化.cs文件中的事件处理方法,一些无法在xaml中绑定的部分在这里绑定 private void init_event() { // 绑定进程模板ComboBox选中项变化的处理方法 ComboBox process_ComboBox = ControlExtensions.FindControl <ComboBox>(this, "process_ComboBox"); process_ComboBox.SelectionChanged += process_ComboBox_Changed; }
/// <summary> /// Handles the RowEditing event of the m_AvailableGridView control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridViewEditEventArgs" /> instance containing the event data.</param> protected void m_AvailableGridView_RowEditing(object sender, GridViewEditEventArgs e) { SPGridView _sender = sender as SPGridView; if (_sender == null) { return; } if (!_sender.FilterFieldValue.IsNullOrEmpty()) { e.Cancel = true; string _msg = "SplittingEntryIsNotSupportedWhenFiltering".GetLocalizedString(); m_AvailablePanel.Controls.Add(ControlExtensions.CreateMessage(_msg)); return; } Label _idLabel = (Label)_sender.Rows[e.NewEditIndex].FindControlRecursive(m_IDItemLabel); if (Selection.SelectionTableRow.IsDisposal(_idLabel.Text)) { e.Cancel = true; string _msg = "SplittingTheItemForTheSelectedGoodsGroupIsNotAllowed".GetLocalizedString(); m_AvailablePanel.Controls.Add(ControlExtensions.CreateMessage(_msg)); return; } _sender.EditIndex = e.NewEditIndex; //NewEditIndex is index of the selected item in filtering mode, but unfortunately entering editing mode the filter is not active. m_AvailableGridViewSkipBinding = true; }
void timer_Elapsed(object sender, ElapsedEventArgs e) { if (playControlViewModel.IsPlay) { ControlExtensions.InvokeIfRequired(this, (x) => { elapsedTimeTextBlock.Text = x.ToString(); time = playControlViewModel.mediaPlayer.Position.ToString(@"mm\:ss"); }, time); ControlExtensions.InvokeIfRequired(this, (x) => { durationSlider.Value = x; sliderNewValue = playControlViewModel.CalculateSliderValue(); }, sliderNewValue); } if (playControlViewModel.IsStop) { ControlExtensions.InvokeIfRequired(this, (x) => { elapsedTimeTextBlock.Text = x.ToString(); playControlViewModel.DurationMP3 = "00:00"; }, "00:00"); } }
// 内置Method列表选中项变化的处理 private void innerMethod_ListBox_Changed(object sender, SelectionChangedEventArgs e) { // 根据不同内置Method应允许不同的算法 ListBox innerMethod_ListBox = ControlExtensions.FindControl <ListBox>(this, "innerMethod_ListBox"); ComboBox crypto_ComboBox = ControlExtensions.FindControl <ComboBox>(this, "crypto_ComboBox"); if (innerMethod_ListBox.SelectedItem == null) // 变成没有选中时,恢复全列表 { crypto_ComboBox.Items = System.Enum.GetValues(typeof(Crypto)); crypto_ComboBox.SelectedItem = Crypto.None; return; } Method method = (Method)innerMethod_ListBox.SelectedItem; switch (method.Name) { // 对称加解密 case "SymEnc": case "SymDec": crypto_ComboBox.Items = Method.Sym; crypto_ComboBox.SelectedItem = Method.Sym[0]; break; // 签名和验证 case "Sign": case "Verify": crypto_ComboBox.Items = Method.ASym.Union(Method.Hash).ToList(); crypto_ComboBox.SelectedItem = Method.ASym[0]; break; // 如果添加了其他的内置方法,要在这里加逻辑 default: break; } }