public ResultInfoVisitor(Command rootCommand) { ResultInfoVisitor visitor = new ResultInfoVisitor(); rootCommand.Visit(visitor); _firstRunResults = visitor.UserInfos; _findRecursive = true; }
public void Run() { while (true) { string commandLine = this.UserInterface.ReadLine(); if (commandLine == null) { break; } commandLine = commandLine.Trim(); if (!string.IsNullOrEmpty(commandLine)) { try { var command = new Command(commandLine); string commandResult = this.CommandExecutor.ExecuteCommand(command); this.UserInterface.WriteLine(commandResult); } catch (Exception ex) { this.UserInterface.WriteLine(ex.Message); } } } }
public MachineStationsVM(MachineVM machine, AccessType access) : base(access) { UnitOfWork = new SoheilEdmContext(); CurrentMachine = machine; MachineDataService = new MachineDataService(UnitOfWork); MachineDataService.StationAdded += OnStationAdded; MachineDataService.StationRemoved += OnStationRemoved; StationDataService = new StationDataService(UnitOfWork); var selectedVms = new ObservableCollection<StationMachineVM>(); foreach (var stationMachine in MachineDataService.GetStations(machine.Id)) { selectedVms.Add(new StationMachineVM(stationMachine, Access, StationMachineDataService, RelationDirection.Reverse)); } SelectedItems = new ListCollectionView(selectedVms); var allVms = new ObservableCollection<StationVM>(); foreach (var station in StationDataService.GetActives(SoheilEntityType.Machines, CurrentMachine.Id)) { allVms.Add(new StationVM(station, Access, StationDataService)); } AllItems = new ListCollectionView(allVms); IncludeCommand = new Command(Include, CanInclude); ExcludeCommand = new Command(Exclude, CanExclude); }
public void MarcoTest() { var a = 1; var b = 2; var actual = 0; var expected = 5; var cmdA = new Command((parameters) => { a++; }); var cmdB = new Command((parameters) => { b++; }); var cmdC = new Command((parameters) => { actual = a + b; }); /// Another way to execute dynamic command: /// var maco=new Macro(); /// macro.Add(() => { a++; }, () => { b++; }, () => { actual = a + b; }); var macro = new Macro(cmdA, cmdB, cmdC); macro.Call(); Assert.AreEqual(expected, actual); }
public LeadListHeaderView(Command newLeadTappedCommand) { _NewLeadTappedCommand = newLeadTappedCommand; #region title label Label headerTitleLabel = new Label() { Text = TextResources.Leads_LeadListHeaderTitle.ToUpperInvariant(), TextColor = Palette._003, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Start, VerticalTextAlignment = TextAlignment.Center }; #endregion #region new lead image "button" var newLeadImage = new Image { Source = new FileImageSource { File = Device.OnPlatform("add_ios_gray", "add_android_gray", null) }, Aspect = Aspect.AspectFit, HorizontalOptions = LayoutOptions.EndAndExpand, }; //Going to use FAB newLeadImage.IsVisible = false; newLeadImage.GestureRecognizers.Add(new TapGestureRecognizer() { Command = _NewLeadTappedCommand, NumberOfTapsRequired = 1 }); #endregion #region absolutLayout AbsoluteLayout absolutLayout = new AbsoluteLayout(); absolutLayout.Children.Add( headerTitleLabel, new Rectangle(0, .5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize), AbsoluteLayoutFlags.PositionProportional); absolutLayout.Children.Add( newLeadImage, new Rectangle(1, .5, AbsoluteLayout.AutoSize, .5), AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.HeightProportional); #endregion #region setup contentView ContentView contentView = new ContentView() { Padding = new Thickness(10, 0), // give the content some padding on the left and right HeightRequest = RowSizes.MediumRowHeightDouble, // set the height of the content view }; #endregion #region compose the view hierarchy contentView.Content = absolutLayout; #endregion Content = contentView; }
/// <summary> /// Initializes a new instance of the <see cref="PersonViewModel"/> class. /// </summary> /// <param name="person">The person.</param> public PersonViewModel(Person person) { Person = person ?? new Person(); GenerateData = new Command<object, object>(OnGenerateDataExecute, OnGenerateDataCanExecute); ToggleCustomError = new Command<object>(OnToggleCustomErrorExecute); }
public void SendCommand( Command command, short commandData ) { byte[] data = new byte[2]; data[0] = (byte) (commandData & 0xFF); data[0] = (byte) (commandData >> 8 ); SendCommand( command, data ); }
public ProductDefectionsVM(ProductVM product, AccessType access):base(access) { UnitOfWork = new SoheilEdmContext(); CurrentProduct = product; ProductDataService = new ProductDataService(UnitOfWork); ProductDataService.DefectionAdded += OnDefectionAdded; ProductDataService.DefectionRemoved += OnDefectionRemoved; DefectionDataService = new DefectionDataService(UnitOfWork); ProductDefectionDataService = new ProductDefectionDataService(UnitOfWork); var selectedVms = new ObservableCollection<ProductDefectionVM>(); foreach (var productDefection in ProductDataService.GetDefections(product.Id)) { selectedVms.Add(new ProductDefectionVM(productDefection, Access, ProductDefectionDataService, RelationDirection.Straight)); } SelectedItems = new ListCollectionView(selectedVms); var allVms = new ObservableCollection<DefectionVM>(); foreach (var defection in DefectionDataService.GetActives(SoheilEntityType.Products, CurrentProduct.Id)) { allVms.Add(new DefectionVM(defection, Access, DefectionDataService)); } AllItems = new ListCollectionView(allVms); IncludeCommand = new Command(Include, CanInclude); ExcludeCommand = new Command(Exclude, CanExclude); IncludeRangeCommand = new Command(IncludeRange, CanIncludeRange); ExcludeRangeCommand = new Command(ExcludeRange, CanExcludeRange); }
public DXToolStripMenuItem(String name, Command cmd) : base() { ci = new CommandInterface(name, cmd, this); this.Click += new EventHandler(cmd.executeEvent); }
public void TestScopeNulledWhenNulled() { IConfigCommand command = new Command() { Scope = null }.ToConfigCommand(); Assert.IsNull(command.Command.Scope); }
public LoginPageViewModel (IMyNavigationService navigationService) { this.navigationService = navigationService; LoggedIn = App.LoggedIn; GoToSignupPage = new Command (() => { this.navigationService.NavigateTo(ViewModelLocator.SignupPageKey); }); Login = new Command ( async () => { // var database = new ECOdatabase(); var database = new AzureDatabase (); // database1.GetUsers(); int rowcount = await database.ValidateUser (Username, Password); if (rowcount == 0) { App.LoggedIn = false; } else { App.LoggedIn = true; //Navigate to homepage without back key this.navigationService.NavigateToModal (ViewModelLocator.HomePageKey); } }); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class. /// </summary> public MainWindowViewModel() : base() { CurrentDummy = new Dummy(444); Reset = new Command(OnResetExecute); Create = new Command(OnCreateExecute); }
public FishboneNodeActionPlansVM(FishboneNodeVM defection, AccessType access) : base(access) { UnitOfWork = new SoheilEdmContext(); CurrentFishboneNode = defection; FishboneNodeDataService = new FishboneNodeDataService(UnitOfWork); FishboneNodeDataService.ActionPlanAdded += OnActionPlanAdded; FishboneNodeDataService.ActionPlanRemoved += OnActionPlanRemoved; ActionPlanDataService = new ActionPlanDataService(UnitOfWork); var selectedVms = new ObservableCollection<ActionPlanFishboneVM>(); foreach (var productFishboneNode in FishboneNodeDataService.GetActionPlans(defection.Id)) { selectedVms.Add(new ActionPlanFishboneVM(productFishboneNode, Access, RelationDirection.Reverse)); } SelectedItems = new ListCollectionView(selectedVms); var allVms = new ObservableCollection<ActionPlanVM>(); foreach (var actionPlan in ActionPlanDataService.GetActives()) { allVms.Add(new ActionPlanVM(actionPlan, Access, ActionPlanDataService)); } AllItems = new ListCollectionView(allVms); IncludeCommand = new Command(Include, CanInclude); ExcludeCommand = new Command(Exclude, CanExclude); }
public override void CommandFinished(Command command) { if (Cube.IsSelected) { UpdateMoveOptionsSelectors(); } }
/// <summary> /// Creates new X10 extended message. /// </summary> /// <param name="house">Valid range is A-P.</param> /// <param name="unit">Valid units are 01-16.</param> /// <param name="command">Only commands ExtendedCode and ExtendedData are valid for extended messages.</param> /// <param name="extendedCommand">Byte 0-255. Make sure that either extended command or data is above 0.</param> /// <param name="extendedData">Byte 0-255. Make sure that either extended command or data is above 0.</param> public ExtendedMessage(House house, Unit unit, Command command, byte extendedCommand, byte extendedData) : base(house, unit, command) { Validate(extendedCommand, extendedData); ExtendedCommand = extendedCommand; ExtendedData = extendedData; }
public MainViewModel(INavigator navigator, IServicioMovil servicio, Session session,IPage page) : base(navigator, servicio, session,page) { CmdAddContact=new Command(Contactos); CmdRecibidos=new Command(Mensajes); CmdEnviados=new Command(MensajesEnviados); CmdOut=new Command(Logout); }
public override void ExitInnerBlock( Command command, Thread thread, Scope scope ) { if ( new TLBit( command.ParamExpression.Evaluate( scope ) ).Value ) thread.EnterBlock( command.InnerBlock ); else thread.Advance(); }
public MessageArgsMsTest(Command command, string projectPath, IpAddressSettings ipAddressSettings, string workingDir, string testListContent, string testListName, string resultsFilePath) : base(command, projectPath, ipAddressSettings, workingDir) { this.TestListContent = testListContent; this.ResultsFilePath = resultsFilePath; this.ListName = testListName; }
public MetaDataPresetsViewModel() { Tags = new ObservableCollection<string>(); using (PresetMetadataDbCommands presetMetadataCommands = new PresetMetadataDbCommands()) { MetadataPresets = new ObservableCollection<PresetMetadata>(presetMetadataCommands.getAllPresets()); } CreatePresetCommand = new Command(new Action(createPreset)); CreatePresetCommand.IsExecutable = false; UpdatePresetCommand = new Command(new Action(updatePreset)); UpdatePresetCommand.IsExecutable = false; DeletePresetCommand = new Command(new Action(deletePreset)); DeletePresetCommand.IsExecutable = false; ClearPresetCommand = new Command(new Action(() => { clear(); })); clear(); }
public ExtenderSettings() { this.commands = new ArrayListDataSet(this); //save command Command saveCmd = new Command(); saveCmd.Description = "Save"; saveCmd.Invoked += new EventHandler(saveCmd_Invoked); this.commands.Add(saveCmd); //cancel command Command cancelCmd = new Command(); cancelCmd.Description = "Cancel"; cancelCmd.Invoked += new EventHandler(cancelCmd_Invoked); this.commands.Add(cancelCmd); this.goToImpersonation = new Command(); this.goToImpersonation.Description = "Impersonation"; this.goToImpersonation.Invoked += new EventHandler(goToImpersonation_Invoked); this.goToTranscode = new Command(); this.goToTranscode.Description = "Transcoding"; this.goToTranscode.Invoked += new EventHandler(goToTranscode_Invoked); this.transcodingDelays = new Choice(this); this.SetupTranscodingOptions(); this.SetupImpersonation(); this.SetupTranscodingDelays(); }
public MainWindowViewModel(IUIVisualizerService visualizerService, IMessageService messageService) { _visualizerService = visualizerService; _messageService = messageService; AddBankCommand = new Command(OnAddBankCommandExecute); }
public override void Oneway(Command command) { lock(transmissionLock) { this.next.Oneway(command); } }
public EmployeeMainPropertiesViewModel(Employee employee) { _departmentRepository = new DepartmentRepository(); _employee = employee; ChangeDepartmentCommand = new Command(ChangeDepartment); }
private bool OnReceiveCommand(SocketState cs, Command c) { if(!requesting || this.IsDisposed || c.CommandType != Command.Type.Screenshot || cs.Connection.RemoteEndPoint.ToString() != this.cs.Connection.RemoteEndPoint.ToString()) { return false; } CommandState cmdState = CommandHandler.HandleCommand(c, cs); try { pbScreenshot.Invoke((MethodInvoker)delegate { tmrScreenshot.Enabled = requesting; tmrScreenshotTimeout.Enabled = false; pbScreenshot.Image = byteArrayToImage((byte[])cmdState.ReturnValue); }, null); } catch (Exception) { //sh.OnReceiveDataCallback = original; return false; } return true; }
private void RunCommand(Command command) { _content = EnsureContent(_content); _negativeWords = EnsureNegativeWords(_negativeWords); _inputOutput.Clear(); _contentProcessor.Run(command, _content, _negativeWords); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class. /// </summary> public MainWindowViewModel() : base() { HomeViewCommand = new Command(OnHomeViewCommandExecute, OnHomeViewCommandCanExecute); AddReport = new Command(OnAddReportExecute, OnAddReportCanExecute); CurrentViewModel = new HomeViewModel(); }
public GenreItem(Library.GalleryItem title, IModelItem owner, List<TitleFilter> filter) : base(owner) { this.Description = title.Name; this.DefaultImage=title.MenuCoverArt; this.Metadata = string.Format("{0} titles", title.ForcedCount); this.Invoked += delegate(object sender, EventArgs args) { //am I being silly here copying this? List<TitleFilter> newFilter = new List<TitleFilter>(); foreach (TitleFilter filt in filter) { newFilter.Add(filt); } newFilter.Add(new TitleFilter(title.Category.FilterType, title.Name)); OMLProperties properties = new OMLProperties(); properties.Add("Application", OMLApplication.Current); properties.Add("I18n", I18n.Instance); Command CommandContextPopOverlay = new Command(); properties.Add("CommandContextPopOverlay", CommandContextPopOverlay); Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(newFilter, title.Description); properties.Add("Page", gallery); OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties); }; }
public override FutureResponse AsyncRequest(Command command) { lock(transmissionLock) { return base.AsyncRequest(command); } }
public void PerformClickShouldExecuteCommand() { var clicked = false; var command = new Command<string>( p => { Assert.Null( p ); clicked = true; } ); var target = new ClickableItem<string>( "test", command ); target.PerformClick(); Assert.True( clicked ); clicked = false; command = new Command<string>( p => { Assert.Equal( "test2", p ); clicked = true; } ); target = new ClickableItem<string>( "test", command ); target.PerformClick( "test2" ); Assert.True( clicked ); }
public override Response Request(Command command, TimeSpan timeout) { lock(transmissionLock) { return base.Request(command, timeout); } }
private (string coreDir, string publishDir, string immutableDir) TestConflictResult( Action <TestProject> testProjectChanges = null, Action <string> publishFolderChanges = null) { var testProject = GetTestProject(); testProject.SourceFiles["Program.cs"] = @" using System; static class Program { public static void Main() { Console.WriteLine(typeof(object).Assembly.Location); Console.WriteLine(typeof(System.Collections.Immutable.ImmutableList).Assembly.Location); } } "; if (testProjectChanges != null) { testProjectChanges(testProject); } var testAsset = _testAssetsManager.CreateTestProject(testProject) .Restore(Log, testProject.Name); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); publishCommand.Execute() .Should() .Pass(); var publishDirectory = publishCommand.GetOutputDirectory(testProject.TargetFrameworks, runtimeIdentifier: testProject.RuntimeIdentifier); if (publishFolderChanges != null) { publishFolderChanges(publishDirectory.FullName); } // Assembly from package should be deployed, as it is newer than the in-box version for netcoreapp2.0, // which is what the app targets publishDirectory.Should().HaveFile("System.Collections.Immutable.dll"); var exePath = Path.Combine(publishDirectory.FullName, testProject.Name + ".dll"); // We want to test a .NET Core 2.0 app rolling forward to .NET Core 2.1. // This wouldn't happen in our test environment as we also have the .NET Core 2.0 shared // framework installed. So we get the RuntimeFrameworkVersion of an app // that targets .NET Core 2.1, and then use the --fx-version parameter to the host // to force the .NET Core 2.0 app to run on that version string rollForwardVersion = GetRollForwardNetCoreAppVersion(); var foo = TestContext.Current.ToolsetUnderTest.CliVersionForBundledVersions; var runAppCommand = Command.Create(TestContext.Current.ToolsetUnderTest.DotNetHostPath, new string[] { "exec", "--fx-version", rollForwardVersion, exePath }); var runAppResult = runAppCommand .CaptureStdOut() .CaptureStdErr() .Execute(); runAppResult .Should() .Pass(); var stdOutLines = runAppResult.StdOut.Split(Environment.NewLine); string coreDir = Path.GetDirectoryName(stdOutLines[0]); string immutableDir = Path.GetDirectoryName(stdOutLines[1]); return(coreDir, publishDirectory.FullName, immutableDir); }
/// <summary> /// Create new navigation property to items for users /// </summary> public Command BuildCreateCommand() { var command = new Command("create"); command.Description = "Create new navigation property to items for users"; // Create options for all the parameters var userIdOption = new Option <string>("--user-id", description: "key: id of user") { }; userIdOption.IsRequired = true; command.AddOption(userIdOption); var driveIdOption = new Option <string>("--drive-id", description: "key: id of drive") { }; driveIdOption.IsRequired = true; command.AddOption(driveIdOption); var bodyOption = new Option <string>("--body") { }; bodyOption.IsRequired = true; command.AddOption(bodyOption); var outputOption = new Option <FormatterType>("--output", () => FormatterType.JSON) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var userId = (string)parameters[0]; var driveId = (string)parameters[1]; var body = (string)parameters[2]; var output = (FormatterType)parameters[3]; var query = (string)parameters[4]; var jsonNoIndent = (bool)parameters[5]; var outputFilter = (IOutputFilter)parameters[6]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[7]; var cancellationToken = (CancellationToken)parameters[8]; using var stream = new MemoryStream(Encoding.UTF8.GetBytes(body)); var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode("application/json", stream); var model = parseNode.GetObjectValue <ApiSdk.Models.ListItem>(ApiSdk.Models.ListItem.CreateFromDiscriminatorValue); var requestInfo = CreatePostRequestInformation(model, q => { }); requestInfo.PathParameters.Add("user%2Did", userId); requestInfo.PathParameters.Add("drive%2Did", driveId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(userIdOption, driveIdOption, bodyOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
/// <summary> /// All items contained in the list. /// </summary> public Command BuildListCommand() { var command = new Command("list"); command.Description = "All items contained in the list."; // Create options for all the parameters var userIdOption = new Option <string>("--user-id", description: "key: id of user") { }; userIdOption.IsRequired = true; command.AddOption(userIdOption); var driveIdOption = new Option <string>("--drive-id", description: "key: id of drive") { }; driveIdOption.IsRequired = true; command.AddOption(driveIdOption); var topOption = new Option <int?>("--top", description: "Show only the first n items") { }; topOption.IsRequired = false; command.AddOption(topOption); var skipOption = new Option <int?>("--skip", description: "Skip the first n items") { }; skipOption.IsRequired = false; command.AddOption(skipOption); var searchOption = new Option <string>("--search", description: "Search items by search phrases") { }; searchOption.IsRequired = false; command.AddOption(searchOption); var filterOption = new Option <string>("--filter", description: "Filter items by property values") { }; filterOption.IsRequired = false; command.AddOption(filterOption); var countOption = new Option <bool?>("--count", description: "Include count of items") { }; countOption.IsRequired = false; command.AddOption(countOption); var orderbyOption = new Option <string[]>("--orderby", description: "Order items by property values") { Arity = ArgumentArity.ZeroOrMore }; orderbyOption.IsRequired = false; command.AddOption(orderbyOption); var selectOption = new Option <string[]>("--select", description: "Select properties to be returned") { Arity = ArgumentArity.ZeroOrMore }; selectOption.IsRequired = false; command.AddOption(selectOption); var expandOption = new Option <string[]>("--expand", description: "Expand related entities") { Arity = ArgumentArity.ZeroOrMore }; expandOption.IsRequired = false; command.AddOption(expandOption); var outputOption = new Option <FormatterType>("--output", () => FormatterType.JSON) { IsRequired = true }; command.AddOption(outputOption); var queryOption = new Option <string>("--query"); command.AddOption(queryOption); var jsonNoIndentOption = new Option <bool>("--json-no-indent", r => { if (bool.TryParse(r.Tokens.Select(t => t.Value).LastOrDefault(), out var value)) { return(value); } return(true); }, description: "Disable indentation for the JSON output formatter."); command.AddOption(jsonNoIndentOption); command.SetHandler(async(object[] parameters) => { var userId = (string)parameters[0]; var driveId = (string)parameters[1]; var top = (int?)parameters[2]; var skip = (int?)parameters[3]; var search = (string)parameters[4]; var filter = (string)parameters[5]; var count = (bool?)parameters[6]; var orderby = (string[])parameters[7]; var select = (string[])parameters[8]; var expand = (string[])parameters[9]; var output = (FormatterType)parameters[10]; var query = (string)parameters[11]; var jsonNoIndent = (bool)parameters[12]; var outputFilter = (IOutputFilter)parameters[13]; var outputFormatterFactory = (IOutputFormatterFactory)parameters[14]; var cancellationToken = (CancellationToken)parameters[15]; var requestInfo = CreateGetRequestInformation(q => { q.QueryParameters.Top = top; q.QueryParameters.Skip = skip; if (!String.IsNullOrEmpty(search)) { q.QueryParameters.Search = search; } if (!String.IsNullOrEmpty(filter)) { q.QueryParameters.Filter = filter; } q.QueryParameters.Count = count; q.QueryParameters.Orderby = orderby; q.QueryParameters.Select = select; q.QueryParameters.Expand = expand; }); requestInfo.PathParameters.Add("user%2Did", userId); requestInfo.PathParameters.Add("drive%2Did", driveId); var errorMapping = new Dictionary <string, ParsableFactory <IParsable> > { { "4XX", ODataError.CreateFromDiscriminatorValue }, { "5XX", ODataError.CreateFromDiscriminatorValue }, }; var response = await RequestAdapter.SendPrimitiveAsync <Stream>(requestInfo, errorMapping: errorMapping, cancellationToken: cancellationToken); response = await outputFilter?.FilterOutputAsync(response, query, cancellationToken) ?? response; var formatterOptions = output.GetOutputFormatterOptions(new FormatterOptionsModel(!jsonNoIndent)); var formatter = outputFormatterFactory.GetFormatter(output); await formatter.WriteOutputAsync(response, formatterOptions, cancellationToken); }, new CollectionBinding(userIdOption, driveIdOption, topOption, skipOption, searchOption, filterOption, new NullableBooleanBinding(countOption), orderbyOption, selectOption, expandOption, outputOption, queryOption, jsonNoIndentOption, new TypeBinding(typeof(IOutputFilter)), new TypeBinding(typeof(IOutputFormatterFactory)), new TypeBinding(typeof(CancellationToken)))); return(command); }
public AboutViewModel() { Title = "About"; OpenWebCommand = new Command(async() => await Browser.OpenAsync("https://xamarin.com")); }
public override bool EvaluateCanExecute(RubberduckParserState state) { return(Command.CanExecute(null)); }
public MainViewModel() { LogOutUserCommand = new Command(OnLogOut); AccountSettingsCommand = new Command(OnAccountSettings); }
public EmployementPageVM(INavigation nav) { Navigation = nav; SaveCommand = new Command(SaveCommandAsync); }
public void placeBlockedCall(string Sender) { Console.WriteLine("Placing Blocked Call"); Settings1 settings = new Settings1(); settings.Reload(); if (calls == null) { calls = new ArrayList(); } else { calls.Clear(); } Console.WriteLine("Created call array"); if (settings.chain) { if (m_callers.Count > 0) { Console.WriteLine("Calling first caller in chain"); Command command = new Command(); command.Command = "call " + m_callers[0].ToString(); m_skype.SendCommand(command); } } else { Console.WriteLine("Calling list of callers at once"); if (m_callers.Count < 4) { m_callers.Add(""); m_callers.Add(""); m_callers.Add(""); m_callers.Add(""); } try { Call call = m_skype.PlaceCall(m_callers[0].ToString(), m_callers[1].ToString(), m_callers[2].ToString(), m_callers[3].ToString()); string filename = "C:/users/Robert/skype/" + call.Id.ToString() + ".wav"; call.set_OutputDevice(TCallIoDeviceType.callIoDeviceTypeFile, filename); incall = true; m_recordings.Add(filename); } catch (Exception ex) { incall = false; emailsent = false; Console.WriteLine("Error with call"); string body = "Error with call to the following numbers: \r\n"; foreach (string number in m_callers) { body += number + "\r\n"; } body += "From email address: " + Sender; Smtp.Net.EmailSender.Send("*****@*****.**", "*****@*****.**", "call error report", body); } } ((ISkype)m_skype).Mute = true; }
private void OptionTab_SelectedTabChanged(object sender, SuperTabStripSelectedTabChangedEventArgs e) { if (OptionTab.SelectedTab.Text == "参数设置") { BSSParameter para = null; if (NetEngine.bConnect) { if (CurrentType) { RangeInput.MaxValue = 100; para = Highpara; if (MainForm.mf.netcore.SendCommand(Command.GetHighParaCMD()) == false) { MainForm.mf.CmdWindow.DisplayAns("无法得到最新高频参数:" + MainForm.mf.netcore.Status); //this.Text = "设置高频声纳参数" + "-无法得到最新高频参数"; } else { MainForm.mf.CmdWindow.DisplayAns("收到最新高频参数:"); //this.Text = "设置高频声纳参数"; } } else { RangeInput.MaxValue = 200; para = Lowpara; if (MainForm.mf.netcore.SendCommand(Command.GetLowParaCMD()) == false) { MainForm.mf.CmdWindow.DisplayAns("无法得到最新低频参数:" + MainForm.mf.netcore.Status); //this.Text = "设置低频声纳参数" + "-无法得到最新低频参数"; } else { MainForm.mf.CmdWindow.DisplayAns("收到最新低频参数:"); //this.Text = "设置低频声纳参数"; } } } else { para = new BSSParameter(false); } //显示参数 RangeInput.Value = para.Range; TvbG.Value = para.TvgG; PortBandWidth.Value = (int)para.PortBandWidth; StartBandWidth.Value = (int)para.StarBoardBandWidth; PortCentralFq.Value = (int)para.PortCentralFq; StartCentralFq.Value = (int)para.StarBoardCentralFq; WorkPeriod.Value = (int)para.Period; PulseLength.Value = (int)para.Ls; TVGDelay.Value = (int)para.TVGDelay; TvgAlpha.Value = (int)para.TvgAlpha; TvgBeta.Value = (int)para.TvgBeta; //发射控制 BitArray ba = new BitArray(BitConverter.GetBytes(para.Flag)); PortSendEnable.Checked = ba[0]; StartSendEnable.Checked = ba[1]; int selectindex = ((ba[2] == true) ? 1 : 0) + ((ba[3] == true) ? 1 : 0) * 2 + ((ba[4] == true) ? 1 : 0) * 4 - 1; PortBox.SelectedIndex = selectindex; selectindex = ((ba[5] == true) ? 1 : 0) + ((ba[6] == true) ? 1 : 0) * 2 + ((ba[7] == true) ? 1 : 0) * 4 - 1; StartBox.SelectedIndex = selectindex; //命令标识 TrigerMode.Checked = para.ComArray[3]; PortFqBox.SelectedIndex = para.ComArray[6] == false ? 0 : 1; StartFqBox.SelectedIndex = para.ComArray[7] == false ? 0 : 1; EnablePortBSS.Checked = para.ComArray[21]; EnableStartBSS.Checked = para.ComArray[22]; CalcTVG.Checked = para.ComArray[24]; SingleWorkValid.Checked = para.ComArray[25]; } }
public ActionResult generarBoardingPass(CDetalleBoleto model) { BoletoVuelo lista1 = null; BoletoVuelo lista2 = null; String tipo = model._tipoBoardingPass; int compara1 = String.Compare(tipo, "Seleccione"); if (compara1 != 0) { int id_bol = model._bol_id; //manejadorSQL_Check modificar = new manejadorSQL_Check(); // OBTENGO EL /LOS VUELOS DEL BOLETO Command <List <Entidad> > comando = FabricaComando.consultarM05listaVuelos(model._bol_id); List <Entidad> lista = comando.ejecutar(); //List<BoletoVuelo> lista = modificar.M05ListarVuelosBoleto(model._bol_id); lista1 = (BoletoVuelo)lista[0]; if (lista.Count == 2) { lista2 = (BoletoVuelo)lista[1]; } // PRIMERO VEO SI ES IDA O IDA Y VUELTA //int ida_vuelta = modificar.MBuscarIdaVuelta(model._bol_id); Command <int> comando2 = FabricaComando.mostrarM05idaVuelta(model._bol_id); int ida_vuelta = comando2.ejecutar(); // EL BOLETO ES IDA 1 // EL BOLETO ES IDA Y VUELTA 2 // DATOS PARA INSERTAR EN PASE DE ABORDAJE CBoardingPass pase2 = new CBoardingPass(); BoardingPass pase; if (ida_vuelta == 1) { pase = (BoardingPass)FabricaEntidad.InstanciarBoardingPass(lista1._id, lista1._fechaPartida, lista1._fechaLlegada, lista1._fechaPartida.TimeOfDay.ToString(), lista1._ruta._origen, lista1._ruta._destino, lista1._ruta._nomOrigen, lista1._ruta._nomDestino, model._bol_id, "A12", model._primer_nombre, model._primer_apellido); } else { int compara = String.Compare(tipo, "Ida"); if (compara == 0) { pase = (BoardingPass)FabricaEntidad.InstanciarBoardingPass(lista1._id, lista1._fechaPartida, lista1._fechaLlegada, lista1._fechaPartida.TimeOfDay.ToString(), lista1._ruta._origen, lista1._ruta._destino, lista1._ruta._nomOrigen, lista1._ruta._nomDestino, model._bol_id, "A12", model._primer_nombre, model._primer_apellido); } else { pase = (BoardingPass)FabricaEntidad.InstanciarBoardingPass(lista2._id, lista2._fechaPartida, lista2._fechaLlegada, lista2._fechaPartida.TimeOfDay.ToString(), lista2._ruta._origen, lista2._ruta._destino, lista2._ruta._nomOrigen, lista2._ruta._nomDestino, model._bol_id, "A12", model._primer_nombre, model._primer_apellido); } } //int resultado1 = modificar.MConteoBoarding(pase._boleto, pase._vuelo); Command <int> comando3 = FabricaComando.conteoM05Boarding(pase._boleto, pase._vuelo); int resultado1 = comando3.ejecutar(); if (resultado1 == 0) { // HACER EL INSERT DE PASE DE ABORDAJE Command <int> comando4 = FabricaComando.crearM05CrearBoarding(pase); int resultado = comando4.ejecutar(); //int resultado = modificar.CrearBoardingPass(pase2); } // TENGO QUE BUSCAR EL ID DEL PASE DE ABORDAJE CREADO Command <int> comando5 = FabricaComando.IdM05paseAbordaje(pase._boleto, pase._vuelo); //int num_boarding = modificar.IdBoardingPass(pase._boleto, pase._vuelo); int num_boarding = comando5.ejecutar(); pase._id = num_boarding; // TENGO QUE INSTANCIAR AL MODELO DE VER BOARDING PASS return(PartialView("M05_VerBoardingPass", pase)); } else { //Creo el codigo de error de respuesta (OJO: AGREGAR EL USING DE SYSTEM.NET) Response.StatusCode = (int)HttpStatusCode.BadRequest; //Agrego mi error String error = "Debe indicar el vuelo a asociar"; //Retorno el error return(Json(error)); } }
internal RuleProcessingContext(Command command) { m_command = command; }
void InitializeComponent() { //exception handling Application.Instance.UnhandledException += (sender, e) => { new DWSIM.UI.Desktop.Editors.UnhandledExceptionView((Exception)e.ExceptionObject).ShowModalAsync(); }; string imgprefix = "DWSIM.UI.Forms.Resources.Icons."; Title = "DWSIMLauncher".Localize(); switch (GlobalSettings.Settings.RunningPlatform()) { case GlobalSettings.Settings.Platform.Windows: ClientSize = new Size(690, 420); break; case GlobalSettings.Settings.Platform.Linux: ClientSize = new Size(690, 365); break; case GlobalSettings.Settings.Platform.Mac: ClientSize = new Size(690, 350); break; } Icon = Eto.Drawing.Icon.FromResource(imgprefix + "DWSIM_ico.ico"); var bgcolor = new Color(0.051f, 0.447f, 0.651f); Eto.Style.Add <Button>("main", button => { button.BackgroundColor = bgcolor; button.Font = new Font(FontFamilies.Sans, 12f, FontStyle.None); button.TextColor = Colors.White; button.ImagePosition = ButtonImagePosition.Left; button.Width = 230; }); var btn1 = new Button() { Style = "main", Text = "OpenSavedFile".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "OpenFolder_100px.png"), 40, 40, ImageInterpolation.Default) }; var btn2 = new Button() { Style = "main", Text = "NewSimulation".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Workflow_100px.png"), 40, 40, ImageInterpolation.Default) }; var btn3 = new Button() { Style = "main", Text = "NewCompound".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Peptide_100px.png"), 40, 40, ImageInterpolation.Default) }; var btn4 = new Button() { Style = "main", Text = "NewDataRegression".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "AreaChart_100px.png"), 40, 40, ImageInterpolation.Default) }; var btn5 = new Button() { Style = "main", Text = "OpenSamples".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "OpenBook_100px.png"), 40, 40, ImageInterpolation.Default) }; var btn6 = new Button() { Style = "main", Text = "Help".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Help_100px.png"), 40, 40, ImageInterpolation.Default) }; var btn7 = new Button() { Style = "main", Text = "About".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "Info_100px.png"), 40, 40, ImageInterpolation.Default) }; var btn8 = new Button() { Style = "main", Text = "Donate".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "PayPal_100px.png"), 40, 40, ImageInterpolation.Default) }; btn5.Click += (sender, e) => { var dialog = new OpenFileDialog(); dialog.Title = "OpenSamples".Localize(); dialog.Filters.Add(new FileFilter("XML Simulation File".Localize(), new[] { ".dwxml", ".dwxmz" })); dialog.MultiSelect = false; dialog.Directory = new Uri(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "samples")); dialog.CurrentFilterIndex = 0; if (dialog.ShowDialog(this) == DialogResult.Ok) { LoadSimulation(dialog.FileName); } }; btn6.Click += (sender, e) => { Process.Start("http://dwsim.inforside.com.br/docs/crossplatform/help/"); }; btn1.Click += (sender, e) => { var dialog = new OpenFileDialog(); dialog.Title = "Open File".Localize(); dialog.Filters.Add(new FileFilter("XML Simulation File".Localize(), new[] { ".dwxml", ".dwxmz" })); dialog.MultiSelect = false; dialog.CurrentFilterIndex = 0; if (dialog.ShowDialog(this) == DialogResult.Ok) { LoadSimulation(dialog.FileName); } }; btn2.Click += (sender, e) => { var form = new Forms.Flowsheet(); AddUserCompounds(form.FlowsheetObject); OpenForms += 1; form.Closed += (sender2, e2) => { OpenForms -= 1; }; form.Show(); }; btn7.Click += (sender, e) => new AboutBox().Show(); btn8.Click += (sender, e) => Process.Start("http://sourceforge.net/p/dwsim/donate/"); var stack = new StackLayout { Orientation = Orientation.Vertical, Spacing = 5 }; stack.Items.Add(btn1); stack.Items.Add(btn2); stack.Items.Add(btn5); stack.Items.Add(btn6); stack.Items.Add(btn7); stack.Items.Add(btn8); var tableright = new TableLayout(); tableright.Padding = new Padding(5, 5, 5, 5); tableright.Spacing = new Size(10, 10); MostRecentList = new ListBox { BackgroundColor = bgcolor, Height = 330 }; if (Application.Instance.Platform.IsGtk && GlobalSettings.Settings.RunningPlatform() == GlobalSettings.Settings.Platform.Mac) { MostRecentList.TextColor = bgcolor; } else { MostRecentList.TextColor = Colors.White; } var invertedlist = new List <string>(GlobalSettings.Settings.MostRecentFiles); invertedlist.Reverse(); foreach (var item in invertedlist) { if (File.Exists(item)) { MostRecentList.Items.Add(new ListItem { Text = item, Key = item }); } } MostRecentList.SelectedIndexChanged += (sender, e) => { if (MostRecentList.SelectedIndex >= 0) { LoadSimulation(MostRecentList.SelectedKey); MostRecentList.SelectedIndex = -1; } ; }; tableright.Rows.Add(new TableRow(new Label { Text = "Recent Files", Font = SystemFonts.Bold(), TextColor = Colors.White })); tableright.Rows.Add(new TableRow(MostRecentList)); var tl = new DynamicLayout(); tl.Add(new TableRow(stack, tableright)); TableContainer = new TableLayout { Padding = 10, Spacing = new Size(5, 5), Rows = { new TableRow(tl) }, BackgroundColor = bgcolor, }; Content = TableContainer; var quitCommand = new Command { MenuText = "Quit".Localize(), Shortcut = Application.Instance.CommonModifier | Keys.Q }; quitCommand.Executed += (sender, e) => Application.Instance.Quit(); var aboutCommand = new Command { MenuText = "About".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "information.png")) }; aboutCommand.Executed += (sender, e) => new AboutBox().Show(); var aitem1 = new ButtonMenuItem { Text = "Preferences".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "icons8-sorting_options.png")) }; aitem1.Click += (sender, e) => { new Forms.Forms.GeneralSettings().GetForm().Show(); }; var hitem1 = new ButtonMenuItem { Text = "Help".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png")) }; hitem1.Click += (sender, e) => { Process.Start("http://dwsim.inforside.com.br/docs/crossplatform/help/"); }; var hitem2 = new ButtonMenuItem { Text = "Discussion Forums".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png")) }; hitem2.Click += (sender, e) => { Process.Start("http://sourceforge.net/p/dwsim/discussion/"); }; var hitem3 = new ButtonMenuItem { Text = "Report a Bug".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png")) }; hitem3.Click += (sender, e) => { Process.Start("https://sourceforge.net/p/dwsim/tickets/"); }; var hitem4 = new ButtonMenuItem { Text = "Go to DWSIM's Website".Localize(), Image = new Bitmap(Eto.Drawing.Bitmap.FromResource(imgprefix + "help_browser.png")) }; hitem4.Click += (sender, e) => { Process.Start("http://dwsim.inforside.com.br"); }; // create menu Menu = new MenuBar { ApplicationItems = { aitem1 }, QuitItem = quitCommand, HelpItems = { hitem1, hitem4, hitem2, hitem3 }, AboutItem = aboutCommand }; Shown += MainForm_Shown; Closing += MainForm_Closing; //check for updates (automatic updater) SetupUpdateItems(); if (GlobalSettings.Settings.AutomaticUpdates && GlobalSettings.Settings.RunningPlatform() == GlobalSettings.Settings.Platform.Windows) { Task.Factory.StartNew(() => LaunchUpdateProcess()); } }
public CancelErrorPageViewModels() { CommandConfirm = new Command(Confirm); }
private void ConfirmBtn_Click(object sender, EventArgs e) { OwnedOption.AutoTVG = checkAutoTVG.Checked; OwnedOption.FreezeTVG = FreezeTVGCheck.Checked; OwnedOption.TVG = ((float)AutoTVGSlide.Value) / 100.0f; OwnedOption.PortA = PortAGainSlider.Value; OwnedOption.PortB = PortBGainSlider.Value; OwnedOption.PortC = PortCGainSlider.Value; OwnedOption.StarboardA = StarAGainSlider.Value; OwnedOption.StarboardB = StarBGainSlider.Value; OwnedOption.StarboardC = StarCGainSlider.Value; OwnedOption.StartColor = ChunkStartBtn.SelectedColor; OwnedOption.EndColor = ChunkEndBtn.SelectedColor; OwnedOption.Gamma = ((float)GammaSlider.Value) / 100.0f; OwnedOption.Fq = HighRd.Checked ? Frequence.High : Frequence.Low; OwnedOption.Gain = GainSlider.Value; OwnedOption.RawMax = (RawMaxBox.SelectedIndex + 1) * 4096; if (OptionTab.SelectedTab.Text == "参数设置")//option { if (NetEngine.bConnect) { //MainForm.mf.CmdWindow.Show(); BSSParameter para = null; if (CurrentType) { para = Highpara; } else { para = Lowpara; } para.Range = (ushort)RangeInput.Value; para.TvgG = (short)TvbG.Value; para.PortCentralFq = (uint)PortCentralFq.Value; para.StarBoardCentralFq = (uint)StartCentralFq.Value; para.PortBandWidth = PortBandWidth.Value; para.StarBoardBandWidth = StartBandWidth.Value; para.Period = (ushort)WorkPeriod.Value; para.Ls = (ushort)PulseLength.Value; para.TVGDelay = (ushort)TVGDelay.Value; para.TvgAlpha = (ushort)TvgAlpha.Value; para.TvgBeta = (ushort)TvgBeta.Value; //发射控制 BitArray ba = new BitArray(32); ba[0] = PortSendEnable.Checked; ba[1] = StartSendEnable.Checked; if (PortBox.SelectedIndex == -1 || StartBox.SelectedIndex == -1) { MessageBox.Show("请选择有效功率"); return; } switch (PortBox.SelectedIndex) { case 0: ba[2] = true; ba[3] = false; ba[4] = false; break; case 1: ba[2] = false; ba[3] = true; ba[4] = false; break; case 2: ba[2] = true; ba[3] = true; ba[4] = false; break; case 3: ba[2] = false; ba[3] = false; ba[4] = true; break; case 4: ba[2] = true; ba[3] = false; ba[4] = true; break; case 5: ba[2] = false; ba[3] = true; ba[4] = true; break; default: ba[2] = false; ba[3] = true; ba[4] = true; break; } switch (StartBox.SelectedIndex) { case 0: ba[5] = true; ba[6] = false; ba[7] = false; break; case 1: ba[5] = false; ba[6] = true; ba[7] = false; break; case 2: ba[5] = true; ba[6] = true; ba[7] = false; break; case 3: ba[5] = false; ba[6] = false; ba[7] = true; break; case 4: ba[5] = true; ba[6] = false; ba[7] = true; break; case 5: ba[5] = false; ba[6] = true; ba[7] = true; break; default: ba[5] = false; ba[6] = true; ba[7] = true; break; } int[] tmp = new int[1]; ba.CopyTo(tmp, 0); para.Flag = (ushort)tmp[0]; //命令标识 if (PortFqBox.SelectedIndex == -1 || StartFqBox.SelectedIndex == -1) { MessageBox.Show("请选择有效调频方向"); return; } para.ComArray[3] = TrigerMode.Checked; para.ComArray[6] = PortFqBox.SelectedIndex == 0 ? false : true; para.ComArray[7] = StartFqBox.SelectedIndex == 0 ? false : true; para.ComArray[21] = EnablePortBSS.Checked; para.ComArray[22] = EnableStartBSS.Checked; para.ComArray[24] = CalcTVG.Checked; para.ComArray[25] = SingleWorkValid.Checked; int[] tmpcmd = new int[1]; para.ComArray.CopyTo(tmpcmd, 0); para.Com = (uint)tmpcmd[0]; if (CurrentType) { MainForm.mf.CmdWindow.DisplayCommand("下发命令:设置高频声纳工作参数"); if (MainForm.mf.netcore.SendCommand(Command.SetupHighBSS(para)) == false) { MainForm.mf.CmdWindow.DisplayAns("下发命令不成功:" + MainForm.mf.netcore.Status); MessageBox.Show("设置高频声纳工作参数失败!"); } else { MessageBox.Show("设置高频声纳工作参数成功!"); } } else { MainForm.mf.CmdWindow.DisplayCommand("下发命令:设置低频声纳工作参数"); if (MainForm.mf.netcore.SendCommand(Command.SetupLowBSS(para)) == false) { MainForm.mf.CmdWindow.DisplayAns("下发命令不成功:" + MainForm.mf.netcore.Status); MessageBox.Show("设置低频声纳工作参数失败!"); } else { MessageBox.Show("设置低频声纳工作参数成功!"); } } } } }
public StateTransition(ProcessState currentState, Command command) { CurrentState = currentState; this.command = command; }
public CommandBuilder(Command command) { Command = command; }
public HelpViewModel() { GoToMainPage = new Command(async() => await OnReadyGoToMainPage()); }
public void add(Command route) { commands.Add(route); }
public LoginViewModel() { LoginCommand = new Command(OnLoginClicked); LoginGuestCommand = new Command(OnLoginGuestClicked); RegisterCommand = new Command(OnRegisterClicked); }
public ProcessState MoveToNextState(Command command) { CurrentState = GetNextState(command); return(CurrentState); }
public ProfileViewModel() { ChangeAvailable = new Command <string>((string id) => ChangeAvailableCommand(id), (string id) => !IsBusy); FetchUser = new Command(async() => await GetUser()); }
public TestItemsViewModel() { Title = "Select Test"; Items = new ObservableCollection <Test>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); }
public IEnumerable <Race> GetAll() { Command cmd = new Command("SELECT * FROM Race"); return(ServiceLocator.Instance.Connection.ExecuteReader(cmd, a => new Race())); }
/// <summary> /// Add command to history. /// </summary> public void AddCommandToHistory(Command command) { undoManager.AddCommandToHistory(command); }
public CalculatorViewModel () { calculatorEngine = new CalculatorEngine (); calculatorEngine.PropertyChanged += CalculatorEnginePropertyChanged; KeyPressCommand = new Command<string> (key => OnKeyPress (key)); }
public Race Get(int id) { Command cmd = new Command("SELECT * FROM Race WHERE Id =" + id); return(ServiceLocator.Instance.Connection.ExecuteReader(cmd, a => new Race()).FirstOrDefault()); }
public HistoryViewModel() { HistoryChartData = new ObservableCollection <CategoryData>(); HistoryChartData1 = new ObservableCollection <CategoryData>(); // And time spent at work ExportText = Resource.Export; ExportCommand = new Command(Export); // Code to get shifts from the past week SelectedDate = DateTime.Now; listOfShifts = dbService.GetShifts(SelectedDate); List <string> number = new List <string>(); foreach (ShiftTable shift in listOfShifts) { if (shift.EndDate != null) { DateTime start = DateTime.Parse(shift.StartDate); DateTime end = DateTime.Parse(shift.EndDate); TimeSpan amountHoursWork = end - start; int hoursWork = amountHoursWork.Hours; int minsWork = amountHoursWork.Minutes; minsWork = minsWork / 100; string datePoint = start.Day + "/" + start.Month; HistoryChartData.Add(new CategoryData { Category = datePoint, Value = hoursWork + minsWork }); HistoryChartData1.Add(new CategoryData { Category = datePoint, Value = (24 - hoursWork) + (0.6 - minsWork) }); if (!number.Contains(datePoint)) { number.Add(datePoint); } } } if (number.Count < 5) { for (int i = 0; i < (5 - number.Count); i++) { HistoryChartData.Add(new CategoryData { Category = (i + 1) + "/0", Value = 0 }); HistoryChartData1.Add(new CategoryData { Category = (i + 1) + "/0", Value = 0 }); } } if (HistoryChartData.Count > 0) { ShiftsAvailable = true; } else { ShiftsAvailable = false; } MaximumDate = DateTime.Now; }
public ScannerViewmodel() { PageTitle = "Scanner"; FinishedCommand = new Command(GoBack); IngredientList = null; }
private Task sendCommand(Command command, byte value = 0) { dc.DigitalValue = false; return(spi.SendReceiveAsync(new[] { (byte)((byte)command | value) })); }
/// <summary> /// Dodawanie komendy do kolejki wykonywania /// </summary> /// <param name="command">Komenda, która zostanie dodana do kolejki</param> public void AddCommand(Command command) { commandQueue?.Enqueue(command); }