public void AfterOpen(ExtensionContext context)
 {
     if (allocations == null)
     {
         allocations = context.Session.Load<IdentityAllocations>("ids") ?? new IdentityAllocations { Id = "ids" };
     }
 }
Beispiel #2
0
        public override void DidSelectPost()
        {
            string shortenedUrl = "";

            try
            {
                foreach (NSItemProvider itemProvider in this.ExtensionContext.InputItems[0].Attachments)
                {
                    if (itemProvider.HasItemConformingTo(MobileCoreServices.UTType.URL))
                    {
                        itemProvider.LoadItem(MobileCoreServices.UTType.URL, null, async(item, error) =>
                        {
                            if (item is NSUrl)
                            {
                                var urlToShorten = ((NSUrl)item).AbsoluteUrl.ToString();

                                var request = new ShortRequest
                                {
                                    TagWt    = false,
                                    TagUtm   = false,
                                    Campaign = ContentText,
                                    Mediums  = new List <string>()
                                    {
                                        "twitter"
                                    },
                                    Input = urlToShorten
                                };

                                var defaults = new NSUserDefaults(Constants.GroupName, NSUserDefaultsType.SuiteName);
                                var url      = defaults.StringForKey(Constants.IOS_SettingsKey);

                                shortenedUrl = await ShorteningService.ShortenUrl(request, url);

                                InvokeOnMainThread(() =>
                                {
                                    UIPasteboard clipboard = UIPasteboard.General;
                                    clipboard.String       = shortenedUrl;

                                    UIAlertController alert = UIAlertController.Create("Share extension", $"https://{shortenedUrl} has been copied!", UIAlertControllerStyle.Alert);
                                    PresentViewController(alert, true, () =>
                                    {
                                        var dt = new DispatchTime(DispatchTime.Now, TimeSpan.FromSeconds(1));
                                        DispatchQueue.MainQueue.DispatchAfter(dt, () =>
                                        {
                                            ExtensionContext.CompleteRequest(null, null);
                                        });
                                    });
                                });
                            }
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Beispiel #3
0
        private async Task FormatErrorAlert()
        {
            var alert = UIAlertController.Create(Strings.ErrorFormat, null, UIAlertControllerStyle.Alert);

            alert.AddAction(UIAlertAction.Create(Strings.Ok, UIAlertActionStyle.Default, (action) => {
                ExtensionContext.CompleteRequest(null, null);
            }));
            await PresentViewControllerAsync(alert, true);
        }
Beispiel #4
0
 partial void DoneClicked(NSObject sender)
 {
     // Return any edited content to the host app.
     // This template doesn't do anything, so we just echo the passed-in items.
     NSOperationQueue.MainQueue.AddOperation(delegate
     {
         ExtensionContext.CompleteRequest(ExtensionContext.InputItems, null);
     });
 }
 protected override void InitializeContext(ExtensionContext extensionContext)
 {
     base.InitializeContext(extensionContext);
     extensionContext.RegisterCondition("ItemType", new ItemTypeCondition(DataObject.GetType()));
     extensionContext.RegisterCondition("ActiveLanguage", new ProjectLanguageCondition(DataObject));
     if (DataObject is Project)
     {
         extensionContext.RegisterCondition("SupportsTarget", new SupportsTargetCondition((Project)DataObject));
     }
 }
        public override void Setup()
        {
            base.Setup();

            pinfo       = new ParameterInfoCondition();
            pinfo.Value = "res";
            GlobalInfoCondition.Value = "res";

            ctx = AddinManager.CreateExtensionContext();
            ctx.RegisterCondition("InputParameter", pinfo);
        }
Beispiel #7
0
 public override void AfterAll(ExtensionContext context)
 {
     try
     {
         _testDirectory.complete(!context.ExecutionException.Present);
     }
     catch (IOException e)
     {
         throw new Exception(e);
     }
 }
        public override void DidSelectPost()
        {
            // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
            UIAlertController alert = UIAlertController.Create("Share extension", "This is the step where you should post the ContentText value: \"" + ContentText + "\" to your targeted service.", UIAlertControllerStyle.Alert);

            PresentViewController(alert, true, () => {
                DispatchQueue.MainQueue.DispatchAfter(new DispatchTime(DispatchTime.Now, 5000000000), () => {
                    ExtensionContext.CompleteRequest(null, null);
                });
            });
        }
Beispiel #9
0
        internal ProjectServiceExtension GetExtensionChain(IBuildTarget target)
        {
            ProjectServiceExtension chain;

            if (target != null)
            {
                lock (target) {
                    ExtensionChainInfo einfo = (ExtensionChainInfo)target.ExtendedProperties [typeof(ExtensionChainInfo)];
                    if (einfo == null)
                    {
                        einfo = new ExtensionChainInfo();
                        ExtensionContext ctx = AddinManager.CreateExtensionContext();
                        einfo.ExtensionContext         = ctx;
                        einfo.ItemTypeCondition        = new ItemTypeCondition(target.GetType());
                        einfo.ProjectLanguageCondition = new ProjectLanguageCondition(target);
                        ctx.RegisterCondition("ItemType", einfo.ItemTypeCondition);
                        ctx.RegisterCondition("ProjectLanguage", einfo.ProjectLanguageCondition);
                        target.ExtendedProperties [typeof(ExtensionChainInfo)] = einfo;
                    }
                    else
                    {
                        einfo.ItemTypeCondition.ObjType = target.GetType();
                        einfo.ProjectLanguageCondition.TargetProject = target;
                    }
                    ProjectServiceExtension[] extensions = einfo.ExtensionContext.GetExtensionObjects <ProjectServiceExtension> ("/MonoDevelop/ProjectModel/ProjectServiceExtensions");
                    chain = CreateExtensionChain(extensions);

                    // After creating the chain there is no need to keep the reference to the target
                    einfo.ProjectLanguageCondition.TargetProject = null;
                }
            }
            else
            {
                if (defaultExtensionChain == null)
                {
                    ExtensionContext ctx = AddinManager.CreateExtensionContext();
                    ctx.RegisterCondition("ItemType", new ItemTypeCondition(typeof(UnknownItem)));
                    ctx.RegisterCondition("ProjectLanguage", new ProjectLanguageCondition(UnknownItem.Instance));
                    ProjectServiceExtension[] extensions = ctx.GetExtensionObjects <ProjectServiceExtension> ("/MonoDevelop/ProjectModel/ProjectServiceExtensions");
                    defaultExtensionChain = CreateExtensionChain(extensions);
                }
                chain  = defaultExtensionChain;
                target = UnknownItem.Instance;
            }

            if (chain.SupportsItem(target))
            {
                return(chain);
            }
            else
            {
                return(chain.GetNext(target));
            }
        }
Beispiel #10
0
        private void UserDidFinishSetup(object sender, EventArgs e)
        {
            // URL of the resource where broadcast can be viewed that will be returned to the application
            var broadcastURL = new NSUrl("https://appr.tc/r/" + _roomNameField.Text);
            // Dictionary with setup information that will be provided to broadcast extension when broadcast
            // is started
            var setupInfo = new NSDictionary <NSString, INSCoding>(new NSString("roomName"), new NSString(_roomNameField.Text));

            // Tell ReplayKit that the extension is finished setting up and can begin broadcasting
            ExtensionContext.CompleteRequest(broadcastURL, setupInfo);
        }
Beispiel #11
0
        public override object BeginPublish(Guid id, string syncRoot, SyncPublisherAction action, ActionArguments args, IPublisherSearchConfig searchConfig)
        {
            var config = new ExtensionContext
            {
                Config        = searchConfig,
                DeployedItems = args.Options.Items.ToList(),
                Id            = id,
                SyncRoot      = syncRoot
            };

            return(config);
        }
Beispiel #12
0
        private void CloseExtension()
        {
            log.Info("Closing Extension...");

            //Static variables can remain for re-use if the Extension runs again from the same instance of the container application. In this
            //demo app this causes more harm than good so we dispose of the session so that it is re-loaded from IosSharedSettings manager next launch
            SessionController.DisposeSession();

            // Return any edited content to the host app.
            // This template doesn't do anything, so we just echo the passed-in items.
            ExtensionContext.CompleteRequest(ExtensionContext.InputItems, null);
        }
Beispiel #13
0
 private void BAddExt_Click(object sender, EventArgs e)
 {
     using (var db = new ExtensionContext())
     {
         var Record = new ListExtension.List {
             Extension = tBAddExt.Text.Trim()
         };
         db.ExtensionDB.Add(Record);
         db.SaveChanges();
     }
     RefleshDataGrid();
 }
Beispiel #14
0
 public override void ProvideCredentialWithoutUserInteraction(ASPasswordCredentialIdentity credentialIdentity)
 {
     if (!IsAuthed() || IsLocked())
     {
         var err = new NSError(new NSString("ASExtensionErrorDomain"),
                               Convert.ToInt32(ASExtensionErrorCode.UserInteractionRequired), null);
         ExtensionContext.CancelRequest(err);
         return;
     }
     _context.CredentialIdentity = credentialIdentity;
     ProvideCredentialAsync().GetAwaiter().GetResult();
 }
        public void Proxy_For_The_Inner_Context()
        {
            // arrange
            var builder = new ContextBuilder()
                          .AddParser("a")
                          .WithAlias("1")
                          .Finish;
            var context = new ExtensionContext(builder.Context);

            // act
            // assert
            context.AliasRepository.HasAlias("a").Should().BeTrue();
        }
        public void CompleteRequest(NSDictionary itemData)
        {
            ServiceContainer.Reset();

            Debug.WriteLine("BW LOG, itemData: " + itemData);
            var resultsProvider = new NSItemProvider(itemData, UTType.PropertyList);
            var resultsItem     = new NSExtensionItem {
                Attachments = new NSItemProvider[] { resultsProvider }
            };
            var returningItems = new NSExtensionItem[] { resultsItem };

            NSRunLoop.Main.BeginInvokeOnMainThread(() => ExtensionContext?.CompleteRequest(returningItems, null));
        }
Beispiel #17
0
        public override void BeforeEach(ExtensionContext extensionContext)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<org.neo4j.graphdb.config.Setting<?>,String> config = new java.util.HashMap<>();
            IDictionary <Setting <object>, string> config = new Dictionary <Setting <object>, string>();

            config[GraphDatabaseSettings.auth_enabled] = Convert.ToString(_authEnabled);
            _gdb = ( GraphDatabaseAPI )(new TestGraphDatabaseFactory()).newImpermanentDatabase(config);
            DependencyResolver resolver       = _gdb.DependencyResolver;
            Authentication     authentication = authentication(resolver.ResolveDependency(typeof(AuthManager)), resolver.ResolveDependency(typeof(UserManagerSupplier)));

            _boltFactory = new BoltStateMachineFactoryImpl(resolver.ResolveDependency(typeof(DatabaseManager)), new UsageData(null), authentication, Clock.systemUTC(), Config.defaults(), NullLogService.Instance);
        }
 public override async void ProvideCredentialWithoutUserInteraction(ASPasswordCredentialIdentity credentialIdentity)
 {
     InitAppIfNeeded();
     if (!await IsAuthed() || await IsLocked())
     {
         var err = new NSError(new NSString("ASExtensionErrorDomain"),
                               Convert.ToInt32(ASExtensionErrorCode.UserInteractionRequired), null);
         ExtensionContext.CancelRequest(err);
         return;
     }
     _context.CredentialIdentity = credentialIdentity;
     await ProvideCredentialAsync();
 }
Beispiel #19
0
        internal void EnsureInitialized()
        {
            if (!initializeCalled)
            {
                initializeCalled = true;

                extensionContext = CreateExtensionContext(this);

                OnInitialize();
                InitializeExtensionChain();
                OnExtensionChainInitialized();
            }
        }
        public override void AfterEach(ExtensionContext context)
        {
            TestDirectory testDirectory = GetStoredValue(context);

            try
            {
                testDirectory.Complete(!context.ExecutionException.Present);
            }
            catch (Exception e)
            {
                throw new JUnitException(format("Fail to cleanup test directory for %s test.", context.DisplayName), e);
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Tell widget it can be expanded
            ExtensionContext.SetWidgetLargestAvailableDisplayMode(NCWidgetDisplayMode.Expanded);

            // Get the maximum size
            var maxSize = ExtensionContext.GetWidgetMaximumSize(NCWidgetDisplayMode.Expanded);

            Console.WriteLine(maxSize);

            // Do any additional setup after loading the view.
        }
        public void BeforeStore(object document, ExtensionContext context)
        {
            object currentId = Conventions.GetId(document);

            if (currentId == null || (currentId is int && (int)currentId == 0))
            {
                var type = document.GetType().Name;
                currentId = allocations.Next(type);

                Conventions.AssignId(document, currentId);

                context.Session.Store(allocations);
            }
        }
        internal void EnsureInitialized()
        {
            if (!initializeCalled)
            {
                initializeCalled = true;

                extensionContext = AddinManager.CreateExtensionContext();
                extensionContext.RegisterCondition("ItemType", new ItemTypeCondition(GetType()));

                OnInitialize();
                InitializeExtensionChain();
                OnExtensionChainInitialized();
            }
        }
Beispiel #24
0
 private bool VerifyExtensionContext(ExtensionContext resultContext, string role, string extensionName, string providerNamespace)
 {
     try
     {
         Assert.AreEqual(role, resultContext.Role.RoleType.ToString());
         Assert.AreEqual(extensionName, resultContext.Extension);
         Assert.AreEqual(providerNamespace, resultContext.ProviderNameSpace);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        partial void OnDoneClicked(UIBarButtonItem sender)
        {
            // Create the NSExtensionItem and NSItemProvider in which we return the image
            var extensionItem = new NSExtensionItem {
                AttributedTitle = new NSAttributedString("Inverted Image"),
                Attachments     = new [] {
                    new NSItemProvider(ImageView.Image, UTType.Image)
                }
            };

            ExtensionContext.CompleteRequest(new [] {
                extensionItem
            }, null);
        }
Beispiel #26
0
        public override void DidSelectPost()
        {
            // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
            var alert = UIAlertController.Create("Share extension", $"This is the step where you should post the ContentText value: '{ContentText}' to your targeted service.", UIAlertControllerStyle.Alert);

            PresentViewController(alert, true, () =>
            {
                DispatchQueue.MainQueue.DispatchAfter(new DispatchTime(DispatchTime.Now, 5000000000), () =>
                {
                    // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.
                    ExtensionContext.CompleteRequest(new NSExtensionItem[0], null);
                });
            });
        }
Beispiel #27
0
        public ProjectServiceExtension GetExtensionChain(IBuildTarget target)
        {
            ProjectServiceExtension chain;

            if (target != null)
            {
                ExtensionChainInfo einfo = (ExtensionChainInfo)Thread.GetData(extensionChainSlot);
                if (einfo == null)
                {
                    einfo = new ExtensionChainInfo();
                    ExtensionContext ctx = AddinManager.CreateExtensionContext();
                    einfo.ExtensionContext         = ctx;
                    einfo.ItemTypeCondition        = new ItemTypeCondition(target.GetType());
                    einfo.ProjectLanguageCondition = new ProjectLanguageCondition(target);
                    ctx.RegisterCondition("ItemType", einfo.ItemTypeCondition);
                    ctx.RegisterCondition("ProjectLanguage", einfo.ProjectLanguageCondition);
                    Thread.SetData(extensionChainSlot, einfo);
                }
                else
                {
                    einfo.ItemTypeCondition.ObjType = target.GetType();
                    einfo.ProjectLanguageCondition.TargetProject = target;
                }
                ProjectServiceExtension[] extensions = (ProjectServiceExtension[])einfo.ExtensionContext.GetExtensionObjects("/MonoDevelop/ProjectModel/ProjectServiceExtensions", typeof(ProjectServiceExtension));
                chain = CreateExtensionChain(extensions);
            }
            else
            {
                if (defaultExtensionChain == null)
                {
                    ExtensionContext ctx = AddinManager.CreateExtensionContext();
                    ctx.RegisterCondition("ItemType", new ItemTypeCondition(typeof(UnknownItem)));
                    ctx.RegisterCondition("ProjectLanguage", new ProjectLanguageCondition(UnknownItem.Instance));
                    ProjectServiceExtension[] extensions = (ProjectServiceExtension[])ctx.GetExtensionObjects("/MonoDevelop/ProjectModel/ProjectServiceExtensions", typeof(ProjectServiceExtension));
                    defaultExtensionChain = CreateExtensionChain(extensions);
                }
                chain  = defaultExtensionChain;
                target = UnknownItem.Instance;
            }

            if (chain.SupportsItem(target))
            {
                return(chain);
            }
            else
            {
                return(chain.GetNext(target));
            }
        }
Beispiel #28
0
        public void Reflesh()
        {
            using (var db = new ExtensionContext())
            {
                var query = from c in db.ListEmailsDB

                            select new { Id = c.EmailsListId, Adres_Email = c.AdresseEmail };

                var results = query.OrderByDescending(x => x.Id).ToList();

                dataGridView2.DataSource = results;
                this.dataGridView2.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
                this.dataGridView2.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            }
        }
 private void SetPreferredContentSize()
 {
     if (ExtensionContext.GetWidgetActiveDisplayMode() == NCWidgetDisplayMode.Compact)
     {
         PreferredContentSize = _collapsedSize;
     }
     else
     {
         var height = (!_data?.Any() ?? true) ? 100 : (_data.Count() * SessionsTable.SectionHeaderHeight) +
                      (_data.SelectMany(g => g.AsEnumerable()).Count() * SessionsTable.EstimatedRowHeight) +
                      SessionsTable.SectionFooterHeight + 70;
         Console.WriteLine($"Requesting widget height: {height}");
         PreferredContentSize = new CGSize(0, height);
     }
 }
Beispiel #30
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void postProcessTestInstance(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
        public override void PostProcessTestInstance(object testInstance, ExtensionContext context)
        {
            Type   clazz    = testInstance.GetType();
            object instance = CreateInstance(context);
            IList <System.Reflection.FieldInfo> declaredFields = GetAllFields(clazz);

            foreach (System.Reflection.FieldInfo declaredField in declaredFields)
            {
                if (declaredField.isAnnotationPresent(typeof(Inject)) && FieldType.Equals(declaredField.Type))
                {
                    declaredField.Accessible = true;
                    declaredField.set(testInstance, instance);
                }
            }
        }
 internal static IEnumerable <ProjectModelExtensionNode> GetModelExtensions(ExtensionContext ctx)
 {
     if (ctx != null)
     {
         return(Runtime.RunInMainThread(() => ctx.GetExtensionNodes(ProjectService.ProjectModelExtensionsPath)).Result.Cast <ProjectModelExtensionNode> ().Concat(customNodes).ToArray());
     }
     else
     {
         if (modelExtensions == null)
         {
             Runtime.RunInMainThread((Action)InitExtensions).Wait();
         }
         return(modelExtensions);
     }
 }
Beispiel #32
0
 public override bool Evaluate(ExtensionContext ctx)
 {
     if (!base.Evaluate(ctx))
     {
         return(false);
     }
     foreach (BaseCondition cond in conditions)
     {
         if (!cond.Evaluate(ctx))
         {
             return(false);
         }
     }
     return(true);
 }
 public void AfterDelete(object document, ExtensionContext context)
 {
 }
 private bool VerifyExtensionContext(ExtensionContext resultContext, string role, string extensionName, string providerNamespace, string version)
 {
     try
     {
         Assert.AreEqual(role, resultContext.Role.RoleType.ToString());
         Assert.AreEqual(extensionName, resultContext.Extension);
         Assert.AreEqual(providerNamespace, resultContext.ProviderNameSpace);
         Assert.AreEqual(version, resultContext.Version);
         return true;
     }
     catch
     {
         return false;
     }
 }
 public void AfterCommit(ExtensionContext context)
 {
 }
 public void AfterStore(object document, ExtensionContext context)
 {
 }
 public void BeforeCommit(IStorageBatch batch, ExtensionContext context)
 {
 }
 public void BeforeDelete(object document, ExtensionContext context)
 {
 }
Beispiel #39
0
		public WizardDialog(ExtensionContext context) : this()
		{
			this.context = context;
		}