Exemplo n.º 1
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case WM_DRAWCLIPBOARD:
                if (Clipboard.ContainsText())
                {
                    NewUrl?.Invoke(Clipboard.GetText());
                }

                SendMessage(NextClipBoardViewerHandle, m.Msg, m.WParam, m.LParam);
                break;

            case WM_CHANGECBCHAIN:
                if (m.WParam.Equals(NextClipBoardViewerHandle))
                {
                    NextClipBoardViewerHandle = m.LParam;
                }
                else if (!NextClipBoardViewerHandle.Equals(IntPtr.Zero))
                {
                    SendMessage(NextClipBoardViewerHandle, m.Msg, m.WParam, m.LParam);
                }
                break;

            case WM_DESTROY:
                ChangeClipboardChain(Handle, NextClipBoardViewerHandle);
                break;
            }

            base.WndProc(ref m);
        }
Exemplo n.º 2
0
        public ViewModel()
        {
            insertNewUrl       = "http";
            newUrl             = "";
            URLSize            = "Please Wait...";
            currentLoadingTime = new Stopwatch();

            StartCommand = new DelegateCommand(() =>
            {
                CheckingURL(NewUrl);
            },
                                               () =>
            {
                return(NewUrl.StartsWith(insertNewUrl));
            });

            Task.Run(() =>
            {
                while (true)
                {
                    StartCommand.RaiseCanExecuteChanged();
                    Thread.Sleep(100);
                }
            });
            Task.Run(() =>
            {
                while (true)
                {
                    loadingTime = GoLoadingTime.ElapsedMilliseconds.ToString();
                }
            });
        }
Exemplo n.º 3
0
        public string GetNewUrl(Uri uri)
        {
            if (!IsRegex || !NewUrl.Contains($"$"))
            {
                return(NewUrl);
            }

            try
            {
                var regexNewUrl = NewUrl;
                var match       = Regex.Match(uri.AbsoluteUri, OldUrl);

                for (var i = 1; i < match.Groups.Count; i++)
                {
                    regexNewUrl = regexNewUrl.Replace($"${i}", match.Groups[i].Value);
                }

                return(regexNewUrl);
            }
            catch (Exception)
            {
                return(NewUrl);
            }
        }
Exemplo n.º 4
0
        public IActionResult OnPostAdd([FromBody] NewUrl newUrl)
        {
            var socialLink = SocialIconsWidget.GetSocialLink(newUrl.Url);

            return(new JsonResult(socialLink));
        }