Пример #1
0
        public static void ExecuteLandscapeRecipe()
        {
            var landscapeRecipe = Repository.Instance.GetRecipe("Landscape");

            if (landscapeRecipe != null && landscapeRecipe.IsAvailable && landscapeRecipe.IsEnabled)
            {
                LaunchHelper.LaunchApp(Constants.APP_TO_LAUNCH_ON_LANDSCAPE);
            }
        }
Пример #2
0
 public static void Main(string[] args)
 {
     LaunchHelper.ProcessLaunch(args,
                                new Dictionary <string, Func <IShardRecordProcessor> >
     {
         { "eventstream1", () => new DemoAppEventProcessor(new JSONSerializer()) }
     }, InitialMain
                                );
 }
Пример #3
0
        public static void ExecuteFavoriteAppRecipe()
        {
            var shakeRecipe = Repository.Instance.GetRecipe("Favorite App");

            if (shakeRecipe != null && shakeRecipe.IsAvailable && shakeRecipe.IsEnabled)
            {
                LaunchHelper.LaunchApp(Constants.APP_TO_LAUNCH_ON_SHAKE);
            }
        }
Пример #4
0
        private void HistoryAdapter_OpenFileRequested(object sender, HistoryListItem e)
        {
            ReceivedFile file;

            if (e.Data.Data is ReceivedFile)
            {
                file = e.Data.Data as ReceivedFile;
            }
            else
            {
                file = (e.Data.Data as ReceivedFileCollection).Files.First();
            }

            var filePath = Path.Combine(file.StorePath, file.Name);

            LaunchHelper.OpenFile(this, filePath);
        }
Пример #5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var args = new List <string>();

            foreach (var item in e.Args)
            {
                if (item == "-delcaches")
                {
                    LaunchHelper.DelCaches();
                }
                else
                {
                    args.Add(item);
                }
            }

            LaunchHelper.Launch(GetArgsStr(args));
            Environment.Exit(0);
        }
Пример #6
0
        public override async void OnMessageReceived(RemoteMessage message)
        {
            base.OnMessageReceived(message);

            try
            {
                if (!message.Data.ContainsKey("Action"))
                {
                    throw new InvalidOperationException();
                }
                else if (message.Data["Action"] == "Wake")
                {
#if DEBUG
                    SendNotification("Wake", "Wake");
#endif
                    var intent = new Intent(this, typeof(MessageCarrierService));
                    intent.PutExtra("Action", "Wake");
                    StartService(intent);
                }
                else if (message.Data["Action"] == "SendCarrier")
                {
#if DEBUG
                    SendNotification("SendCarrier", "SendCarrier");
#endif
                    var intent = new Intent(this, typeof(MessageCarrierService));
                    intent.PutExtra("Action", "SendCarrier");
                    intent.PutExtra("DeviceId", message.Data["WakerDeviceId"]);

                    Android.Util.Log.Debug("CARRIER_DEBUG", "1");

                    StartService(intent);
                }
                else if (message.Data["Action"] == "Payload")
                {
#if DEBUG
                    SendNotification("Payload", "Payload");
#endif
                    var intent = new Intent(this, typeof(WaiterService));
                    intent.PutExtra("Data", message.Data["Data"]);

                    StartService(intent);
                }
                else if ((message.Data["Action"] == "LaunchUrl") && (message.Data.ContainsKey("Url")))
                {
                    try
                    {
                        string url = message.Data["Url"];
                        LaunchHelper.LaunchUrl(this, url);
                    }
                    catch (Exception ex)
                    {
                        Log.Debug(TAG, ex.Message);
                        ToastHelper.ShowToast(this, "Couldn't launch URL.", Android.Widget.ToastLength.Long);
                    }
                }
                else if ((message.Data["Action"] == "FastClipboard") && (message.Data.ContainsKey("SenderName")) && (message.Data.ContainsKey("Text")))
                {
                    string senderName = message.Data["SenderName"];
                    string text       = message.Data["Text"];

                    Guid guid = await TextReceiver.QuickTextReceivedAsync(senderName, text);

                    await ClipboardHelper.CopyTextToClipboard(this, guid);
                }
                else if (message.Data["Action"] == "CloudClipboard")
                {
                    if (message.Data.ContainsKey("Data"))
                    {
                        string text = message.Data["Data"];

                        var settings = new Settings(this);

                        if (message.Data.ContainsKey("AccountId"))
                        {
                            if (CrossSecureStorage.Current.HasKey("RoamitAccountId"))
                            {
                                CrossSecureStorage.Current.DeleteKey("RoamitAccountId");
                            }

                            CrossSecureStorage.Current.SetValue("RoamitAccountId", message.Data["AccountId"]);
                        }

                        if (settings.CloudClipboardReceiveMode == CloudClipboardReceiveMode.Automatic)
                        {
                            CloudClipboardNotifier.SetCloudClipboardValue(this, text);
                        }
                        else
                        {
                            settings.CloudClipboardText = text;
                            CloudClipboardNotifier.SendCloudClipboardNotification(this, text);
                        }
                    }
                }
                else
                {
                    throw new InvalidOperationException();
                }
            }
            catch (InvalidOperationException)
            {
                SendNotification($"Action '{message.Data["Action"]}' not supported.", "Please make sure the app is updated to enjoy latest features.");
            }
        }
Пример #7
0
 private void CloseProgram_button_Click(object sender, EventArgs e)
 {
     LaunchHelper.SaveValuesBeforeClosing();
     Process.GetCurrentProcess().Kill();
 }
Пример #8
0
 private void DataAdapter_OpenFileRequested(object sender, ReceivedFile e)
 {
     LaunchHelper.OpenFile(this, Path.Combine(e.StorePath, e.Name));
 }
Пример #9
0
 private void HistoryAdapter_UrlLaunchRequested(object sender, HistoryListItem e)
 {
     LaunchHelper.LaunchUrl(this, (e.Data.Data as ReceivedUrl).Uri.OriginalString);
 }