コード例 #1
0
        public AppViewModel()
        {
            LoadAllPeople("AppViewModel", null).ContinueWith((t) => { });

            AddPerson = new CoreCommand(async(obj) =>
            {
                var result = await this.SqliteDb.AddOrUpdate <Person>(NewPerson);
                if (result.Success)
                {
                    NewPerson = new Person();
                    await LoadAllPeople("AddPerson", () =>
                    {
                        Navigation.PushNonAwaited <PageTwo>();
                    });
                }
                else
                {
                    DialogPrompt.ShowMessage(new Prompt()
                    {
                        Title   = "Error",
                        Message = result.Error.Message
                    });
                }
            });



            ViewPeople = new Command(async(obj) =>
            {
                await LoadAllPeople("ViewPeople", () => {
                    Navigation.PushNonAwaited <PageTwo>();
                });
            });
        }
コード例 #2
0
        public AppViewModel()
        {
            LoadAllPeople("AppViewModel", null).ContinueWith((t) => { });

            AddPerson = new CoreCommand(async(obj) =>
            {
                var result = await this.LiteDb.Insert(NewPerson);
                if (result.Success)
                {
                    NewPerson = new Person();
                    await LoadAllPeople("AddPerson", async() =>
                    {
                        await Navigation.PushAsync(new PageTwo());
                    });
                }
                else
                {
                    DialogPrompt.ShowMessage(new Prompt()
                    {
                        Title   = "Error",
                        Message = result.Error.Message
                    });
                }
            });

            ViewPeople = new CoreCommand(async(obj) =>
            {
                await Navigation.PushAsync(new PageTwo());
            });
        }
コード例 #3
0
ファイル: EventsBot.cs プロジェクト: codacy-badger/SecondBot
        public bool CreateAwaitEventReply(string event_listener, CoreCommand command, string[] args)
        {
            string eventid = "" + event_listener + "" + next_await_id.ToString() + "";

            next_await_id++;
            if (await_events.ContainsKey(event_listener) == false)
            {
                await_events.Add(event_listener, new Dictionary <string, KeyValuePair <CoreCommand, string[]> >());
            }
            if (await_events[event_listener].ContainsKey(eventid) == false)
            {
                if (await_event_ages.ContainsKey(eventid) == false)
                {
                    if (await_event_idtolistener.ContainsKey(eventid) == false)
                    {
                        await_events[event_listener].Add(eventid, new KeyValuePair <CoreCommand, string[]>(command, args));
                        await_event_ages.Add(eventid, helpers.UnixTimeNow());
                        await_event_idtolistener.Add(eventid, event_listener);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(false);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        public SomeViewModel()
        {
            SomeAction = new CoreCommand(async(obj) =>
            {
                LoadingMessageHUD = "Some action...";
                IsLoadingHUD      = true;
                await Task.Delay(new TimeSpan(0, 0, 4));
                IsLoadingHUD = false;
            });
            SeeFontAction = new Command(async() => {
                await Navigation.PushAsync(new FontDemo());
            });
            GoogleLoginAction = new CoreCommand(async(obj) =>
            {
                var authResult = await WebAuthenticator.AuthenticateAsync(
                    new Uri("https://cloudmovieweb.azurewebsites.net/mobileauth/Google"),
                    new Uri("cloudmovie.mobile://"));

                AccountToken = authResult?.AccessToken;
            });
            MicrosoftLoginAction = new CoreCommand(async(obj) =>
            {
                var authResult = await WebAuthenticator.AuthenticateAsync(
                    new Uri("https://cloudmovieweb.azurewebsites.net/mobileauth/Microsoft"),
                    new Uri("cloudmovie.mobile://"));

                AccountToken = authResult?.AccessToken;
            });
        }
コード例 #5
0
        public AppViewModel()
        {
            this.CouchDb.GetAll <Person>().ContinueWith((t) =>
            {
                if (t.Result != null)
                {
                    People = t.Result.ToObservable();
                }
                else
                {
                    People = new ObservableCollection <Person>();
                }
            });


            AddPerson = new CoreCommand(async(obj) => {
                var result = await this.CouchDb.AddOrUpdate <Person>(NewPerson);
                if (result != null)
                {
                    NewPerson = new Person();
                    People    = await CouchDb.GetAll <Person>().ToObservable();
                    Navigation.PushNonAwaited <PageTwo>();
                }
            });

            ViewPeople = new CoreCommand((obj) => {
                Navigation.PushNonAwaited <PageTwo>();
            });
        }
コード例 #6
0
        public TodoViewModel()
        {
            SaveCurrentItem = new CoreCommand(async(obj) => {
                CurrentItem.UserId = CoreSettings.AppUser.Id;
                var saveResult     = await this.TodoLogic.AddOrUpdateTodo(CurrentItem);
                if (saveResult.success)
                {
                    CurrentTodoList.Add(saveResult.todo);
                    DataExists  = CurrentTodoList.Count > 0 ? true : false;
                    CurrentItem = new Todo();
                    NavigateBack();
                }
                else
                {
                    this.DialogPrompt.ShowMessage(new Prompt()
                    {
                        Title   = "Error",
                        Message = saveResult.error.Message
                    });
                }
            });

            FABClicked = new CoreCommand(async(obj) =>
            {
                await Navigation.PushAsync(new AddTodoPage(), true);
            });

            RefreshData = new CoreCommand(async(obj) => {
                IsRefreshing    = true;
                CurrentTodoList = await this.TodoLogic.GetAllByCurrentUser().ToObservable();
                IsRefreshing    = false;
                DataExists      = CurrentTodoList.Count > 0 ? true : false;
            });
        }
コード例 #7
0
 protected void NotifyValidationErrors(CoreCommand message)
 {
     foreach (var error in message.ValidationResults.Errors)
     {
         _bus.RaiseEvent(new CRMCoreNotification(message.MessageType, error.ErrorMessage));
     }
 }
コード例 #8
0
ファイル: CoreMessage.cs プロジェクト: deathlef/VhaBot
 public CoreMessage(string target, string source, string sourcePlugin, CoreCommand command)
 {
     this._type        = MessageType.Core;
     this._target      = target;
     this._source      = source;
     this.SourcePlugin = sourcePlugin;
     this.Command      = command;
 }
コード例 #9
0
        public AppViewModel()
        {
            adInterstitial = this.AdInterstitial;

            ShowInterstitial = new CoreCommand((obj) => {
                adInterstitial.ShowAd();
            });
            RemoveAds = new CoreCommand(async(obj) => {
                await MakePurchase();
            });
        }
コード例 #10
0
        protected override ICanvas <ConsolePixelData> ExecuteInternal(
            ICanvas <ConsolePixelData> canvas,
            IConsoleInputContext inputContext)
        {
            CoreCommand.Fill(
                canvas,
                ParsePoint(inputContext, 1, 2),
                ParseColour(inputContext, 3));

            return(canvas);
        }
コード例 #11
0
 public AccountViewModel()
 {
     LoginUser    = new CoreCommand(async(obj) => { await LoginUserMethod(); });
     RegisterUser = new CoreCommand(
         async(obj) => { await RegisterUserMethod(); },
         ValidateRegistration,
         this);
     SaveProfile = new CoreCommand(
         async(obj) => { await SaveProfileMethod(); },
         ValidateProfileSave,
         this);
 }
コード例 #12
0
        public AppViewModel()
        {
            RandomUsers = new ObservableCollection <RandomUser>();

            GetRandomUsers().ContinueWith((t) => { });

            GetFavorites().ContinueWith((t) => { });

            SearchCommand = new CoreCommand((obj) => {
                var search = obj;
            });
        }
コード例 #13
0
 public SomeViewModel()
 {
     SomeAction = new CoreCommand(async(obj) =>
     {
         LoadingMessageHUD = "Some action...";
         IsLoadingHUD      = true;
         await Task.Delay(new TimeSpan(0, 0, 4));
         IsLoadingHUD = false;
     });
     SeeFontAction = new Command(async() => {
         await Navigation.PushAsync(new FontDemo());
     });
 }
コード例 #14
0
 public SomeViewModel()
 {
     SomeAction = new CoreCommand(async(obj) =>
     {
         LoadingMessageHUD = "Some action...";
         IsLoadingHUD      = true;
         await Task.Delay(new TimeSpan(0, 0, 4));
         IsLoadingHUD = false;
     });
     ClickEvent = new CoreCommand((obj) =>
     {
         ClickCount++;
     });
 }
コード例 #15
0
        protected override ICanvas <ConsolePixelData> ExecuteInternal(
            ICanvas <ConsolePixelData> canvas,
            IConsoleInputContext inputContext)
        {
            // Currently only default supported.
            var defaultForegroundPixel = _canvasConfiguration.DefaultForegroundPixel;

            CoreCommand.Draw(
                canvas,
                ParsePoint(inputContext, 1, 2),
                ParsePoint(inputContext, 3, 4),
                defaultForegroundPixel);

            return(canvas);
        }
コード例 #16
0
        public AppViewModel()
        {
            this.Chat.ConnectToServerAsync().ContinueOn();

            StartSession = new CoreCommand((obj) => {
                if (!string.IsNullOrEmpty(FriendlyName))
                {
                    Navigation.PushNonAwaited <ChatPage>();
                }
            });

            SendMessage = new CoreCommand(async(obj) => {
                await this.Chat.SendMessageAsync(TextMessage, FriendlyName);
                TextMessage = string.Empty;
            }, () => { return(IsConnect && !string.IsNullOrEmpty(TextMessage)); }, this);
        }
コード例 #17
0
        public DataExampleViewModel()
        {
            BackgroundButtonTitle = "Background Timer";

            CreateErrorEntry       = new CoreCommand(CreateErrorEntryMethod);
            ClearErrorEntries      = new CoreCommand(ClearErrorEntriesMethod);
            ClearAnalyticEntries   = new CoreCommand(ClearAnalyticEntriesMethod);
            LoadMorePaginatedUsers = new CoreCommand(GetPaginatedRandomUsers);
            HashText           = new CoreCommand(HashTextMethod);
            EncryptText        = new CoreCommand(EncryptTextMethod);
            HttpDownloadStart  = new CoreCommand(GetRandomUsers);
            SqliteLoadStart    = new CoreCommand(GetDbAppointments);
            StartBackgrounding = new CoreCommand(StartBackgroundingMethod);
            HttpPost           = new CoreCommand(HttpPostMethod);
            LongDownload       = new CoreCommand(LongDownloadMethod);
        }
コード例 #18
0
 public SearchViewModel()
 {
     _map.InitialViewpoint = new Viewpoint(34.05293, -118.24368, 6000);
     AddressSearchCommand  = new CoreCommand(async(obj) =>
     {
         // Initialize the LocatorTask with the provided service Uri
         _geocoder = await LocatorTask.CreateAsync(_serviceUri);
         await UpdateSearch();
     });
     StartGeolocation = new CoreCommand(async(obj) =>
     {
         // Initialize the LocatorTask with the provided service Uri
         _geocoder = await LocatorTask.CreateAsync(_serviceUri);
         await UpdateCurrentLocation();
     });
 }
コード例 #19
0
        protected override ICanvas <ConsolePixelData> ExecuteInternal(
            ICanvas <ConsolePixelData> canvas,
            IConsoleInputContext inputContext)
        {
            var dimensions = ParsePoint(inputContext, 1, 2);

            if (_canvasConfiguration.MaxHeight.HasValue && dimensions.Y > _canvasConfiguration.MaxHeight)
            {
                throw new ValidationException($"Maximum height is {_canvasConfiguration.MaxHeight}.");
            }

            if (_canvasConfiguration.MaxWidth.HasValue && dimensions.X > _canvasConfiguration.MaxWidth)
            {
                throw new ValidationException($"Maximum width is {_canvasConfiguration.MaxWidth}.");
            }

            return(CoreCommand.Create(dimensions.X, dimensions.Y));
        }
コード例 #20
0
        public SimpleViewModel()
        {
            PushButtonLabel = "Register Push Notification";

            var radioOptions = new List <string>(
                new string[] { "Blue", "Red", "Green" }
                );

            RadioOptions = radioOptions.ToObservable <string>();

            var stateResults = DataBLL.GetAllStates();

            if (stateResults.Error == null)
            {
                States = stateResults.Response.ToObservable();
            }

            DialogClick       = new CoreCommand(DialogClickMethod);
            NotificationClick = new CoreCommand(NotificationClickMethod);
            OverlayClick      = new CoreCommand(OverlayClickMethod);
            Blur               = new CoreCommand(BlurNewMethod);
            CreateCalendar     = new CoreCommand(CreateCalendarMethod);
            PushRegister       = new CoreCommand(PushRegisterMethod);
            ShowSnack          = new CoreCommand(ShowSnackMethod);
            PlaySound          = new CoreCommand(PlaySoundMethod);
            CommTest           = new CoreCommand(CommTestMethod);
            ContextMenu        = new CoreCommand(ContextMenuMethod);
            BindingTextChanged = new CoreCommand(BindingTextChangedMethod);
            SendSMS            = new CoreCommand(SendSMSMethod);
            SendEmail          = new CoreCommand(SendEmailMethod);
            MakeCall           = new CoreCommand(MakeCallMethod);
            MakeCallEvent      = new CoreCommand(MakeCallEventMethod);
            FABClicked         = new CoreCommand(FABClickedMethod);
            ClickEvent         = new CoreCommand((obj) => { ClickCount++; });

            /*
             *  This is an example of command validators. ValidateTextFields is part of the CommonCore
             *  extensions and validators can be chained with more complex rules for numbers and dates
             */
            CanExecute = new CoreCommand(CanExecuteMethod,
                                         () => { return(this.ValidateTextFields(this.FirstName)); },
                                         this);
        }
コード例 #21
0
 public StartViewModel()
 {
     BasicMapCommand = new CoreCommand(async(obj) =>
     {
         await Navigation.PushAsync(new MapPage());
     });
     CurrentLocationCommand = new CoreCommand(async(obj) =>
     {
         await Navigation.PushAsync(new CurrentLocationPage());
     });
     AddressLocatorCommand = new CoreCommand(async(obj) =>
     {
         await Navigation.PushAsync(new AddressSearchPage());
     });
     RoutingCommand = new CoreCommand(async(obj) =>
     {
         await Navigation.PushAsync(new OptimizedRoutingPage());
     });
 }
コード例 #22
0
        private void InitCommands()
        {
            var initServer = new CoreCommand("InitServer");

            initServer.AddService(_server);

            var initServerCommand = _commandFactory.GetCoreCommand(initServer);

            var serverThreading = new CoreCommand("ServerThread");

            // ORDER OF THE ADDED SERVICES MATTERS!
            serverThreading.AddService(initServerCommand);
            serverThreading.AddService(_services);
            serverThreading.AddService(_writer);

            var serverThreadCommand = _commandFactory.GetCoreCommand(serverThreading);

            serverThreadCommand.Execute();
        }
コード例 #23
0
        public AppViewModel()
        {
            PopulateData();

            ViewListControl = new CoreCommand((obj) => {
                Navigation.PushNonAwaited <ListControlPage>();
            });
            ViewBehaviors = new CoreCommand((obj) => {
                Navigation.PushNonAwaited <BehaviorsPage>();
            });

            ViewSelectedDisplay = new CoreCommand((obj) => {
                if (SelectedDisplayInfo != null)
                {
                    this.DialogPrompt.ShowMessage(new Prompt()
                    {
                        Title   = "Selected Item:",
                        Message = SelectedDisplayInfo.Title
                    });
                }
            });
        }
コード例 #24
0
        public AppViewModel()
        {
            People = RealmDb.All <Person>().ToObservable();

            queryToken = RealmDb.All <Person>().SubscribeForNotifications((sender, changes, error) =>
            {
                People = RealmDb.All <Person>().ToObservable();
            });

            AddPerson = new CoreCommand((obj) => {
                RealmDb.Write(() =>
                {
                    RealmDb.Add(NewPerson);
                    NewPerson = new Person();
                });
                Navigation.PushNonAwaited <PageTwo>();
            });

            ViewPeople = new CoreCommand((obj) => {
                Navigation.PushNonAwaited <PageTwo>();
            });
        }
コード例 #25
0
        public SpheroCommandPacket(CoreCommand commandId,
                                   byte sequenceNumber, params byte[] packetData)
            : base()
        {
            this.data = new byte[7 + (packetData != null ? packetData.Length : 0)];

            this.data[0] = 0xFF;                    // SOP1
            this.data[1] = 0xFF;                    // SOP2
            this.data[2] = (byte)DeviceID.DID_CORE; // Device ID
            this.data[3] = (byte)commandId;         // Command ID
            this.data[4] = sequenceNumber;

            if (packetData != null)
            {
                this.data[5] = (byte)(packetData.Length + 1);
                Array.Copy(packetData, 0, this.data, 6, packetData.Length);
            }
            else
            {
                this.data[5] = 0x01;
            }

            this.data[this.data.Length - 1] = CalculateChecksum(this.data);
        }
コード例 #26
0
ファイル: SomeViewModel.cs プロジェクト: NCleverly/Core
 public SomeViewModel()
 {
     LoadMorePaginatedData = new CoreCommand(GetPaginatedData);
     RereshCommand         = new CoreCommand(RefeshData);
 }
コード例 #27
0
        public static string FullName(this CoreCommand code)
        {
            switch (code)
            {
            case CoreCommand.CMD_ASSIGN_TIME:
                return("Assign Time");

            case CoreCommand.CMD_CLEAR_COUNTERS:
                return("Clear Counters");

            case CoreCommand.CMD_CONTROL_UART_TX:
                return("Control UART TX");

            case CoreCommand.CMD_GET_AUTO_RECONNECT:
                return("Get Auto Reconnect");

            case CoreCommand.CMD_GET_BT_NAME:
                return("Get BT Name");

            case CoreCommand.CMD_GET_PWR_STATE:
                return("Get Power State");

            case CoreCommand.CMD_GOTO_BL:
                return("Goto BL");

            case CoreCommand.CMD_PING:
                return("Ping");

            case CoreCommand.CMD_POLL_TIMES:
                return("Poll Times");

            case CoreCommand.CMD_RUN_L1_DIAGS:
                return("Run L1 Diagnostics");

            case CoreCommand.CMD_RUN_L2_DIAGS:
                return("Run L2 Diagnostics");

            case CoreCommand.CMD_SET_AUTO_RECONNECT:
                return("Set Auto Reconnect");

            case CoreCommand.CMD_SET_BT_NAME:
                return("Set By Name");

            case CoreCommand.CMD_SET_PWR_NOTIFY:
                return("Set Power Notify");

            case CoreCommand.CMD_SLEEP:
                return("Sleep");

            case CoreCommand.CMD_VERSION:
                return("Version");

            case CoreCommand.GET_POWER_TRIPS:
                return("Get Power Trips");

            case CoreCommand.SET_INACTIVE_TIMER:
                return("Set Inactive Timer");

            case CoreCommand.SET_POWER_TRIPS:
                return("Set Power Trips");

            default:
                return("Unknown Code");
            }
        }
コード例 #28
0
 public AuthenticationViewModel()
 {
     GoogleAuth    = new CoreCommand((obj) => { GoogleAuthMethod(); });
     FaceBookAuth  = new CoreCommand((obj) => { FaceBookAuthMethod(); });
     MicrosoftAuth = new CoreCommand(async(obj) => { await MicrosoftAuthMethod(); });
 }
コード例 #29
0
        /// <summary>
        /// Initialize library
        /// </summary>
        /// <param name="loader"></param>
        /// <param name="dte2"></param>
        /// <param name="addIn"></param>
        private void init(ILoader loader, DTE2 dte2, AddIn addIn)
        {
            try
            {
                library = loader.load(dte2, addIn.SatelliteDllPath, dte2.RegistryRoot);
                log.info("Library: loaded from '{0}' :: v{1} [{2}] API: v{3} /'{4}':{5}",
                                                    library.Dllpath,
                                                    library.Version.Number.ToString(),
                                                    library.Version.BranchSha1,
                                                    library.Version.Bridge.Number.ToString(2),
                                                    library.Version.BranchName,
                                                    library.Version.BranchRevCount);

                coreCommand = new CoreCommand(library);
                coreCommand.attachCoreCommandListener();

                updateBuildType(Environment.GetCommandLineArgs());
                adviseEvents();
                return;
            }
            catch(DllNotFoundException ex)
            {
                log.info(ex.Message);
                log.info(new String('.', 80));
                log.info("How about:");

                log.info("");
                log.info("* Install vsSolutionBuildEvent as plugin for your Visual Studio v{0}", dte2.Version);
                log.info("* Or manually place the 'vsSolutionBuildEvent.dll' with dependencies into AddIn folder: '{0}\\'", Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
                log.info("");

                log.info("See documentation for more details:");
                log.info("- http://vssbe.r-eg.net");
                log.info("- http://visualstudiogallery.msdn.microsoft.com/0d1dbfd7-ed8a-40af-ae39-281bfeca2334/");
                log.info("");

                log.info("Minimum requirements: vsSolutionBuildEvent.dll v{0}", loader.MinVersion.ToString());
                log.info(new String('.', 80));
            }
            catch(ReflectionTypeLoadException ex)
            {
                log.info(ex.ToString());
                log.info(new String('.', 80));

                foreach(FileNotFoundException le in ex.LoaderExceptions) {
                    log.info("{2} {0}{3} {0}{0}{4} {0}{1}",
                                        Environment.NewLine,
                                        new String('~', 80),
                                        le.FileName,
                                        le.Message,
                                        le.FusionLog);
                }
            }
            catch(Exception ex) {
                log.info("Error with advising '{0}'", ex.ToString());
            }

            termination(true);
        }