Beispiel #1
0
        /// <summary>
        /// 缓存实时生效
        /// </summary>
        /// <returns></returns>
        public bool EffectiveSync()
        {
            try
            {
                //时间戳
                long ts = DateTime.Now.Ticks;

                string requestUrl = Extensions.AppSettings("SyncEffective", "");

                string requestParams = string.Format("ts={0}&sign={1}", ts.ToString(), ts.ToString().MD5());

                LogHelper.Default.Debug("实时生效:" + requestUrl);

                string result = WebExtension.Post(requestUrl, new Des().Encrypt(requestParams));

                ResponseCode currentEntity = result.JsonDeserialize <ResponseCode>();

                if (currentEntity.rescode.Equals("0"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Default.Error(ex.ToString());
                return(false);
            }
        }
        public static void Run()
        {
            // ExStart:1
            //Source directory
            string outDir = RunExamples.Get_OutputDirectory();

            Workbook workbook = new Workbook();

            WebExtensionCollection         extensions = workbook.Worksheets.WebExtensions;
            WebExtensionTaskPaneCollection taskPanes  = workbook.Worksheets.WebExtensionTaskPanes;

            int extensionIndex = extensions.Add();
            int taskPaneIndex  = taskPanes.Add();

            WebExtension extension = extensions[extensionIndex];

            extension.Reference.Id        = "wa104379955";
            extension.Reference.StoreName = "en-US";
            extension.Reference.StoreType = WebExtensionStoreType.OMEX;

            WebExtensionTaskPane taskPane = taskPanes[taskPaneIndex];

            taskPane.IsVisible    = true;
            taskPane.DockState    = "right";
            taskPane.WebExtension = extension;

            workbook.Save(outDir + "AddWebExtension_Out.xlsx");
            // ExEnd:1

            Console.WriteLine("AddWebExtension executed successfully.");
        }
Beispiel #3
0
        /// <summary>
        /// Register the given WebExtension to the given runtime instance of a GeckoView
        /// This method is used to forward event based on WebExtension id to the right GeckoView instance
        /// The WebExtension id will be generated by this method
        /// </summary>
        internal static void RegisterWebExtension(BlazorGeckoView blazorGeckoView, GeckoRuntime runtime, string webExtensionLocation)
        {
            if (blazorGeckoView == null)
            {
                throw new ArgumentNullException(nameof(blazorGeckoView));
            }

            if (runtime == null)
            {
                throw new ArgumentNullException(nameof(runtime));
            }

            //We do a preliminary check if a same runtime on another GeckoView is used. We must not register a WebExtension twice if it is already present on a runtime. We assume that we are using our BlazorWebview as a solo-instance behavior
            if (RuntimeHasWebExtension(runtime, webExtensionLocation))
            {
                //Already registered. Ignore registration
                return;
            }

            //Get an unique identity
            int identity = GenerateWebExtensionIdentity();

            WebExtension webExtension = new WebExtension(webExtensionLocation, identity.ToString());

            //Register the given WebExtension to the runtime
            runtime.RegisterWebExtension(webExtension);

            //Register the WebExtension registration in our dictionnary
            AddRuntimeWebExtensionReference(runtime, webExtension);

            //Register the Webview with this identity attached to retrieve it later by WebExtension identity
            WebViewHelper.RegisterWebView(blazorGeckoView, identity);
        }
Beispiel #4
0
        /// <summary>
        /// 根据无级子级找顶级父级留言id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int GetParentMessageIdByChildId(int id)
        {
            var raw = WebExtension.GetDbContext <DataContext>().Database.SqlQuery <int>("exec sp_getParentMessageIdByChildId " + id);

            if (raw.Any())
            {
                return(raw.FirstOrDefault());
            }
            return(0);
        }
Beispiel #5
0
        private static void AddRuntimeWebExtensionReference(GeckoRuntime runtime, WebExtension webExtension)
        {
            int runtimeIdentity = runtime.GetHashCode();

            if (!_runtimeExtensionDico.ContainsKey(runtimeIdentity))
            {
                _runtimeExtensionDico.Add(runtimeIdentity, new List <WebExtensionMetadata>());
            }

            _runtimeExtensionDico[runtimeIdentity].Add(new WebExtensionMetadata(webExtension.Id, webExtension.Location));
        }
Beispiel #6
0
 /// <summary>
 /// 通过存储过程获得自己以及自己所有的子元素集合
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public DbRawSqlQuery <LeaveMessage> GetSelfAndAllChildrenMessagesByParentId(int id) => WebExtension.GetDbContext <DataContext>().Database.SqlQuery <LeaveMessage>("exec sp_getChildrenLeaveMsgByParentId " + id);
 /// <summary>
 /// 通过存储过程获得自己以及自己所有的子元素集合
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public DbRawSqlQuery <Comment> GetSelfAndAllChildrenCommentsByParentId(int id)
 {
     return(WebExtension.GetDbContext <DataContext>().Database.SqlQuery <Comment>("exec sp_getChildrenCommentByParentId " + id));
 }
Beispiel #8
0
 /// <summary>
 /// 根据无级子级找顶级父级评论id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public List <int> GetParentIdById(int id)
 {
     return(WebExtension.GetDbContext <DataContext>().Database.SqlQuery <int>("exec sp_getParentMenuIdByChildId " + id).ToList());
 }
Beispiel #9
0
 /// <summary>
 /// 通过存储过程获得自己以及自己所有的子元素集合
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public DbRawSqlQuery <MenuOutputDto> GetSelfAndChildrenByParentId(int id)
 {
     return(WebExtension.GetDbContext <DataContext>().Database.SqlQuery <MenuOutputDto>("exec sp_getChildrenMenuByParentId " + id));
 }
Beispiel #10
0
 /// <summary>
 /// 通过存储过程获得自己以及自己所有的子元素集合
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public DbRawSqlQuery <Menu> GetChildrenMenusByParentId(int id)
 {
     return(WebExtension.GetDbContext <DataContext>().Database.SqlQuery <Menu>("exec sp_getChildrenMenusByParentId " + id));
 }