private void AddDataCommand_Click(object sender, EventArgs e) { if (AvailableCommandList.SelectedIndex < 0) { MessageBox.Show("Please select an available data command to move"); return; } DataCommand command = (DataCommand)AvailableCommandList.SelectedItem; ScreenDataCommand c = new ScreenDataCommand(); List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>(); c.Name = command.Name; foreach (DataCommandParameter parameter in command.Parameters) { ScreenDataCommandParameter p = new ScreenDataCommandParameter(); p.InputType = ScreenInputType.Control; p.Name = parameter.Name; p.InputKey = parameter.Name.Replace("@", "").Replace("'", "").Replace(" ", ""); c.Parameters.Add(p); } DataCommands.Add(c); FillLists(); }
public List <ScreenDataCommandParameter> GetPopulatedCommandParameters(string DataCommandName, BasePage page, Control Container, List <ScreenDataCommand> datacommands) { string ErrorFormat = "Invalid {0} propery for Data Command {1} Parameter {2} - {3}"; List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>(); ScreenDataCommand screenCommand = ScreenDataCommand.GetDataCommand(datacommands, DataCommandName); if ((screenCommand != null) && (screenCommand.Parameters != null)) { parameters = ObjectCopier.Clone <List <ScreenDataCommandParameter> >(screenCommand.Parameters); foreach (ScreenDataCommandParameter p in parameters) { try { p.Value = Common.GetParameterInputValue(page, p, Container); } catch (Exception ex) { throw new ApplicationException( String.Format(ErrorFormat, "Value", DataCommandName, p.Name, ex.Message), ex); } } } return(parameters); }
public static List <ScreenDataCommandParameter> GetPopulatedCommandParameters(string DataCommandName, IMobilePage page, List <ScreenDataCommand> datacommands) { string ErrorFormat = "Invalid {0} propery for Data Command {1} Parameter {2} - {3}"; List <ScreenDataCommandParameter> parameters = new List <ScreenDataCommandParameter>(); ScreenDataCommand screenCommand = ScreenDataCommand.GetDataCommand(datacommands, DataCommandName); if ((screenCommand != null) && (screenCommand.Parameters != null)) { foreach (ScreenDataCommandParameter existingP in screenCommand.Parameters) { ScreenDataCommandParameter p = existingP.Clone(); try { p.Value = Common.GetParameterInputValue(page, p); parameters.Add(p); } catch (Exception ex) { throw new Exception( String.Format(ErrorFormat, "Value", DataCommandName, p.Name, ex.Message), ex); } } } return(parameters); }
//private void Close_Click(object sender, EventArgs e) //{ // this.DialogResult = DialogResult.OK; //} private void PageCommandList_SelectedIndexChanged(object sender, EventArgs e) { DisableParameterGrid(); ScreenDataCommand item = (ScreenDataCommand)PageCommandList.SelectedItem; RefreshDataCommandParameters(item); FillParameterList(item.Parameters); this.SelectedDataCommandLabel.Text = this.PageCommandList.Text + " Parameter(s)"; EnableParameterGrid(); }
private void RemoveDataCommand_Click(object sender, EventArgs e) { if (this.PageCommandList.SelectedIndex < 0) { MessageBox.Show("Please select a data command tied to this page"); return; } ScreenDataCommand item = (ScreenDataCommand)PageCommandList.SelectedItem; DataCommands.Remove(item); FillLists(); }
private void RefreshDataCommandParameters(ScreenDataCommand item) { //get data command DataCommand c = DataCommand.GetDataCommand(item.Name); if (c != null) { //loop through screen data command parameters List <ScreenDataCommandParameter> remove = new List <ScreenDataCommandParameter>(); foreach (ScreenDataCommandParameter p in item.Parameters) { ScreenDataCommandParameter localP = p; if (!c.Parameters.Exists(x => x.Name == localP.Name)) { remove.Add(localP); } } //are there any missing from data command - if so remove foreach (ScreenDataCommandParameter p in remove) { item.Parameters.Remove(p); } //loop through data command parameters foreach (DataCommandParameter p in c.Parameters) { DataCommandParameter localP = p; if (!item.Parameters.Exists(x => x.Name == localP.Name)) { //are there any missing from screen command parameters - if so add with control as default ScreenDataCommandParameter sp = new ScreenDataCommandParameter(); sp.InputType = ScreenInputType.Control; sp.Name = p.Name; sp.InputKey = p.Name.Replace("@", "").Replace("'", "").Replace(" ", ""); item.Parameters.Add(sp); } } } }
/// <summary> /// Initalize values. /// </summary> public NavBarViewModel() : base("Nav") { _pm = IoC.Get <PulseManager>(); _events = IoC.Get <IEventAggregator>(); _adcpConn = IoC.Get <AdcpConnection>(); _IsRecording = false; this.NotifyOfPropertyChange(() => this.IsRecording); // Set the record image SetRecorderImage(); // Warning timer _recorderTimer = new System.Timers.Timer(); _recorderTimer.Interval = 2000; // 2 seconds. _recorderTimer.Elapsed += _recorderTimer_Elapsed; _recorderTimer.AutoReset = true; _recorderTimer.Start(); // Command to go back a view BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Command to go to Home View HomeCommand = ReactiveCommand.Create(); HomeCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Command to go to SmartPage View ConfigureCommand = ReactiveCommand.Create(); ConfigureCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SmartPageView))); // Command to go to ViewData View ViewDataCommand = ReactiveCommand.Create(); ViewDataCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView))); //// Command to go to Playback data //PlaybackCommand = ReactiveCommand.Create(); //PlaybackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SelectPlaybackView))); // Select a file to playback PlaybackCommand = ReactiveCommand.Create(); PlaybackCommand.Subscribe(_ => PlaybackFile()); // Command to go to ScreenData View ScreenDataCommand = ReactiveCommand.Create(); ScreenDataCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ScreenDataView))); // Command to go to Project View ProjectCommand = ReactiveCommand.Create(); ProjectCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ProjectView))); // Command to go to VesselMount Options View VmOptionsCommand = ReactiveCommand.Create(); VmOptionsCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.VesselMountOptionsView))); // Command to go to Data Format View DataFormatCommand = ReactiveCommand.Create(); DataFormatCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.DataFormatView))); // Command to go to VesselMount Options View AveragingCommand = ReactiveCommand.Create(); AveragingCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AveragingView))); // Set the Clock time to Local System time on the ADCP StartTestingCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.IsTesting, x => !x.Value), _ => Task.Run(() => On_StartTesting())); // Create a command to stop testing StopTestingCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.IsTesting, x => x.Value), _ => Task.Run(() => On_StopTesting())); }