Inheritance: System.Windows.Window
コード例 #1
0
 public AddBookmark(string title, string url, MainWindow mw)
 {
     InitializeComponent();
     TitleBox.Text = title;
     _url = url;
     mainWindow = mw;
 }
コード例 #2
0
 public void RefreshFavs(MainWindow mw)
 {
     Dispatcher.BeginInvoke((Action) (() =>
     {
         try
         {
             bookmarks.ItemsCount = 0;
             bookmarks.RowsCount = 0;
             bookmarks.mainCanvas.Children.Clear();
             if (System.IO.File.Exists(StaticDeclarations.Bookmarkspath))
             {
                 string readFile = System.IO.File.ReadAllText(StaticDeclarations.Bookmarkspath);
                 dynamic json = JsonConvert.DeserializeObject(readFile);
                 foreach (dynamic item in json)
                 {
                     TabView tabView = bookmarks.FindParent<TabView>();
                     bookmarks.AddBookmark(Convert.ToString(item.Url), Convert.ToString(item.Title), tabView, mw);
                 }
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine("Refresh settings error: " + ex.Message + " " + ex.Data);
         }
     }));
 }
コード例 #3
0
        public TabView(MainWindow mw, string url)
        {
            InitializeComponent();

            //Assignments

            mainWindow = mw;
            LastWebsite = "";
            WebView.LifeSpanHandler = this;
            splitChar = (char)42;
            WebView.DownloadHandler = this;
            WebView.DisplayHandler = this;
            BrowserSettings s1 = new BrowserSettings();
            s1.LocalStorage = CefState.Enabled;
            s1.Databases = CefState.Enabled;
            s1.ApplicationCache = CefState.Enabled;
            s1.WindowlessFrameRate = 60;
            WebView.BrowserSettings = s1;
            refreshing = false;
            allItems1 = new List<string>();

            //Events

            WebView.FrameLoadEnd += WebView_FrameLoadEnd;
            WebView.TitleChanged += WebView_TitleChanged;
            Loaded += TabView_Loaded;
            WebView.IsBrowserInitializedChanged += WebView_IsBrowserInitializedChanged;
            WebView.FrameLoadStart += WebView_FrameLoadStart;

            HideSuggestions();

            urlToLoad = url;
        }
コード例 #4
0
        public void AddTab(OpenTabCommandParameters commandParams, MainWindow mw)
        {
            UserControl userControl;

            if(commandParams.Control == null)
            {
                 userControl = new TabView(mw, commandParams.Url);
            }
            else
            {
                userControl = commandParams.Control;
            }

            Dispatcher.BeginInvoke((Action) (() =>
            {
                tab = new Tab(commandParams.Title, mw, userControl, commandParams.Brush);

                tab.Width = tabWidth;
                tab.Height = tabHeight;
                canvas.Children.Add(tab);
                Canvas.SetLeft(tab, TabCount * tabWidth);
                Canvas.SetTop(tab, 0);
                Canvas.SetTop(AddButton, 0);
                if (AddButtonCount == 1)
                {
                    AddButton.BeginAnimation(Canvas.LeftProperty,
                        new DoubleAnimation(0, AddButtonCount * tabWidth, TimeSpan.FromMilliseconds(moveButtonDuration)));
                }
                else
                {
                    AddButton.BeginAnimation(Canvas.LeftProperty,
                        new DoubleAnimation(Canvas.GetLeft(AddButton), AddButtonCount * tabWidth, TimeSpan.FromMilliseconds(moveButtonDuration)));
                }
                TabCount += 1;
                AddButtonCount += 1;
                TabCollection.Add(tab);

                var fade = new DoubleAnimation()
                {
                    From = 0,
                    To = 1,
                    Duration = TimeSpan.FromSeconds(0.25),
                };
                Storyboard.SetTarget(fade, tab);
                Storyboard.SetTargetProperty(fade, new PropertyPath(Button.OpacityProperty));

                var sb = new Storyboard();
                sb.Children.Add(fade);
                sb.Begin();

                CalcSizes();
            }));
        }
コード例 #5
0
 public AddBookmark(string title, string url, MainWindow mw)
 {
     InitializeComponent();
     TitleBox.Text = title;
     _url = url;
     DoneButton.Text("DONE");
     CloseButton.ImageSource("close_button.png");
     CloseButton.SetRippleMargin(1);
     CloseButton.SetImageScale(16);
     DoneButton.ChangeTextColor("#FF1ABC9C");
     mainWindow = mw;
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: amaitland/WebExpress-beta
        public static int Main(string[] args)
        {
            //For self hosted BrowserSubProcess this must be the first thing out application executes
            var exitCode = Cef.ExecuteProcess();

            if (exitCode >= 0)
            {
                return exitCode;
            }

            var app = new App();
            var win = new MainWindow();

            //Do WPF init and start windows message pump.
            return app.Run(win);
        }
コード例 #7
0
ファイル: Tab.xaml.cs プロジェクト: amaitland/WebExpress-beta
 public Tab(string title, MainWindow mw, UserControl uc, System.Windows.Media.Brush brush)
 {
     Dispatcher.BeginInvoke((Action) (() =>
     {
         darkColor = false;
         InitializeComponent();
         form = uc;
         color = brush;
         actualForeground = Brushes.Black;
         form.HorizontalAlignment = HorizontalAlignment.Stretch;
         form.VerticalAlignment = VerticalAlignment.Stretch;
         label_TabTitle.Content = title;
         Loaded += Tab_Loaded;
         mainWindow = mw;
         closeTabMargin = 8;
         favIconMargin = 6;
     }));
 }
コード例 #8
0
 public async Task LoadFavs(MainWindow mw)
 {
    await Dispatcher.BeginInvoke((Action) (() =>
     {
         try
         {
             if (System.IO.File.Exists(StaticDeclarations.Bookmarkspath))
             {
                 string readFile = System.IO.File.ReadAllText(StaticDeclarations.Bookmarkspath);
                 dynamic json = JsonConvert.DeserializeObject(readFile);
                 foreach (dynamic item in json)
                 {
                     TabView tabView = bookmarks.FindParent<TabView>();
                     bookmarks.AddBookmark(Convert.ToString(item.Url), Convert.ToString(item.Title), tabView, mw);
                 }
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine("Load bookmarks error: " + ex.Message + " " + ex.Data);
         }
     }));
 }
コード例 #9
0
 public void loadFavs(MainWindow mw)
 {
     Dispatcher.BeginInvoke((Action) (() =>
     {
         try {
             string[] readText = System.IO.File.ReadAllLines(TabView.Bookspath);
             ArrayList arr = new ArrayList();
             foreach (var sr in readText)
             {
                 arr.Add(sr);
             }
             Grid parent = this.Parent as Grid;
             TabView parent2 = parent.Parent as TabView;
             foreach (string s in arr)
             {
                 string[] split = s.Split((char)42);
                 bookmarks.AddBookmark(split[0], split[1], parent2, mw);
             }
         } catch (Exception ex)
         {
             Console.WriteLine("LoadFavs error: " + ex.Message);
         }
     }));
 }
コード例 #10
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MainGrid = ((WebExpress.MainWindow)(target));

            #line 10 "..\..\..\..\Windows\MainWindow.xaml"
                this.MainGrid.StateChanged += new System.EventHandler(this.MainGrid_StateChanged);

            #line default
            #line hidden

            #line 10 "..\..\..\..\Windows\MainWindow.xaml"
                this.MainGrid.Activated += new System.EventHandler(this.MainGrid_PreviewMouseDown);

            #line default
            #line hidden
                return;

            case 2:
                this.Grid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:

            #line 41 "..\..\..\..\Windows\MainWindow.xaml"
                ((System.Windows.Controls.Grid)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Grid_MouseDown);

            #line default
            #line hidden
                return;

            case 4:
                this.TabBar = ((WebExpress.TabBar)(target));
                return;

            case 5:
                this.Close = ((System.Windows.Controls.Button)(target));

            #line 44 "..\..\..\..\Windows\MainWindow.xaml"
                this.Close.Click += new System.Windows.RoutedEventHandler(this.Close_Click);

            #line default
            #line hidden

            #line 44 "..\..\..\..\Windows\MainWindow.xaml"
                this.Close.MouseEnter += new System.Windows.Input.MouseEventHandler(this.Close_MouseEnter);

            #line default
            #line hidden

            #line 44 "..\..\..\..\Windows\MainWindow.xaml"
                this.Close.MouseLeave += new System.Windows.Input.MouseEventHandler(this.Close_MouseLeave);

            #line default
            #line hidden
                return;

            case 6:
                this.CloseImage = ((System.Windows.Controls.Image)(target));
                return;

            case 7:
                this.Maximize = ((System.Windows.Controls.Button)(target));

            #line 49 "..\..\..\..\Windows\MainWindow.xaml"
                this.Maximize.Click += new System.Windows.RoutedEventHandler(this.Maximize_Click);

            #line default
            #line hidden

            #line 49 "..\..\..\..\Windows\MainWindow.xaml"
                this.Maximize.MouseEnter += new System.Windows.Input.MouseEventHandler(this.Maximize_MouseEnter);

            #line default
            #line hidden

            #line 49 "..\..\..\..\Windows\MainWindow.xaml"
                this.Maximize.MouseLeave += new System.Windows.Input.MouseEventHandler(this.Maximize_MouseLeave);

            #line default
            #line hidden
                return;

            case 8:
                this.MaximizeImage = ((System.Windows.Controls.Image)(target));
                return;

            case 9:
                this.Minimize = ((System.Windows.Controls.Button)(target));

            #line 54 "..\..\..\..\Windows\MainWindow.xaml"
                this.Minimize.MouseEnter += new System.Windows.Input.MouseEventHandler(this.Minimize_MouseEnter);

            #line default
            #line hidden

            #line 54 "..\..\..\..\Windows\MainWindow.xaml"
                this.Minimize.MouseLeave += new System.Windows.Input.MouseEventHandler(this.Minimize_MouseLeave);

            #line default
            #line hidden

            #line 54 "..\..\..\..\Windows\MainWindow.xaml"
                this.Minimize.Click += new System.Windows.RoutedEventHandler(this.Minimize_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.MinimizeImage = ((System.Windows.Controls.Image)(target));
                return;

            case 11:
                this.container = ((System.Windows.Controls.Grid)(target));

            #line 61 "..\..\..\..\Windows\MainWindow.xaml"
                this.container.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.container_PreviewMouseDown);

            #line default
            #line hidden
                return;

            case 12:
                this.Menu = ((WebExpress.Controls.Menu)(target));
                return;

            case 13:
                this.Downloads1 = ((WebExpress.Downloads)(target));
                return;
            }
            this._contentLoaded = true;
        }