private void Window1_Loaded(object sender, RoutedEventArgs e) { AeroGlassHelper.ExtendGlass(this, (int)windowContent.Margin.Left, (int)windowContent.Margin.Right, (int)windowContent.Margin.Top, (int)windowContent.Margin.Bottom); txtSSID.Text = Settings.Default.SSID; txtPassword.Text = Settings.Default.Password; // This line is for testing purposes //panelConnections.Children.Add(new PeerDevice(new ConnectedPeer() { MacAddress = "AA-22-33-EE-EE-FF" })); var args = System.Environment.GetCommandLineArgs(); var minarg = (from a in args where a.ToLowerInvariant().Contains("/min") select a).FirstOrDefault(); if (!string.IsNullOrEmpty(minarg)) { this.WindowState = WindowState.Minimized; this.ShowInTaskbar = false; } this.AddSystemMenuItems(); this.threadUpdateUI = new Thread(new ThreadStart(this.UpdateUIThread)); this.threadUpdateUI.Start(); this.Closed += new EventHandler(Window1_Closed); // Show System Tray Icon var stream = Application.GetResourceStream(new Uri("icons/virtualrouterdisabled.ico", UriKind.Relative)).Stream; var icon = new System.Drawing.Icon(stream); this.trayIcon = new WpfNotifyIcon(); this.trayIcon.Icon = icon; this.trayIcon.Show(); //this.trayIcon.Text = "Virtual Router (Disabled)"; this.trayIcon.Text = VirtualRouterClient.Properties.Resources.VDisabled; this.trayIcon.DoubleClick += new EventHandler(trayIcon_DoubleClick); var trayMenu = new System.Windows.Forms.ContextMenuStrip(); //trayMenu.Items.Add("&Manage Virtual Router...", null, new EventHandler(this.TrayIcon_Menu_Manage)); trayMenu.Items.Add(VirtualRouterClient.Properties.Resources.Manage, null, new EventHandler(this.TrayIcon_Menu_Manage)); trayMenu.Items.Add(new System.Windows.Forms.ToolStripSeparator()); //trayMenu.Items.Add("Check for &Updates...", null, new EventHandler(this.TrayIcon_Menu_Update)); trayMenu.Items.Add(VirtualRouterClient.Properties.Resources.Updates, null, new EventHandler(this.TrayIcon_Menu_Update)); //trayMenu.Items.Add("&About...", null, new EventHandler(this.TrayIcon_Menu_About)); trayMenu.Items.Add(VirtualRouterClient.Properties.Resources.About, null, new EventHandler(this.TrayIcon_Menu_About)); this.trayIcon.ContextMenuStrip = trayMenu; this.StateChanged += new EventHandler(WindowMain_StateChanged); UpdateDisplay(); }
internal MainWindow() { // this object should be initialized before loading UI components, because many of which are binding to it. ContextObject = new ContextObject(); InitializeComponent(); // do not set TopMost property if we are now debugging. it makes debugging painful... if (!Debugger.IsAttached) { Topmost = true; } // restore changes by Designer windowPanel.Opacity = 0d; busyIndicatorLayer.Visibility = Visibility.Visible; Loaded += (sender, e) => AeroGlassHelper.EnableBlur(this); buttonCloseWindow.MouseLeftButtonUp += (sender, e) => Close(); titlebarTitleArea.MouseLeftButtonDown += DragMoveCurrentWindow; }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (loaded == false) { SolidColorBrush color; if (Properties.Settings.Default.use_system_color) { color = new SolidColorBrush( System.Windows.Media.Color.FromArgb(Properties.Settings.Default.system_color.A, Properties.Settings.Default.system_color.R, Properties.Settings.Default.system_color.G, Properties.Settings.Default.system_color.B)); } else { //color = new SolidColorBrush(Colors.SkyBlue); color = (SolidColorBrush) new BrushConverter().ConvertFromString(AeroGlassHelper.GetColor()); } TweetBlock.Inlines.Clear(); string tweet = Status.Text.Trim().Replace("\n", " "); string[] kaas = tweet.Split(' '); #region textprocessing for (int b = 0; b < kaas.Length; b++) { string a = kaas[b]; if (a.Length > 1) { bool hasperiodend = false; bool hascommaend = false; if (a.StartsWith(".")) { TweetBlock.Inlines.Add(new Run(HttpUtility.HtmlDecode("."))); a = a.Remove(0, 1); } if (a.StartsWith(",")) { TweetBlock.Inlines.Add(new Run(HttpUtility.HtmlDecode(","))); a = a.Remove(0, 1); } if (a.EndsWith(".")) { a = a.Substring(0, a.LastIndexOf(".")); hasperiodend = true; } if (a.EndsWith(",")) { a = a.Substring(0, a.LastIndexOf(",")); hascommaend = true; } if (a.StartsWith("@")) { string username = a.Replace("@", ""); username.Replace(":", ""); Hyperlink uname = new Hyperlink(new Run(a)) { NavigateUri = new Uri("http://twitter.com/" + username) }; uname.RequestNavigate += Hyperlink_RequestNavigateEvent; uname.TextDecorations = null; uname.Foreground = color; TweetBlock.Inlines.Add(uname); } else if (a.StartsWith("#")) { string hashtag = a.Replace("#", ""); Hyperlink hash = new Hyperlink() { NavigateUri = new Uri("http://search.twitter.com/search?q=" + hashtag) }; hash.Inlines.Add(a); hash.RequestNavigate += Hyperlink_RequestNavigateEvent; hash.TextDecorations = null; hash.Foreground = color; TweetBlock.Inlines.Add(hash); } else if (a.StartsWith("http")) { if (a.StartsWith("https://")) { string url = a.Replace("https://", ""); if (a != "https://" && a != "https" && a != "https:" && !String.IsNullOrEmpty(url)) { try { Hyperlink link = new Hyperlink() { NavigateUri = new Uri(a) }; link.Inlines.Add(url); link.RequestNavigate += Hyperlink_RequestNavigateEvent; link.TextDecorations = null; link.Foreground = color; TweetBlock.Inlines.Add(link); } catch (Exception) { TweetBlock.Inlines.Add(a); } } else { TweetBlock.Inlines.Add(a); } } else if (a.StartsWith("http://")) { string url = a.Replace("http://", ""); if (a != "http://" && a != "http" && a != "http:" && !String.IsNullOrEmpty(url)) { try { Hyperlink link = new Hyperlink() { NavigateUri = new Uri(a) }; link.Inlines.Add(url); link.RequestNavigate += Hyperlink_RequestNavigateEvent; link.TextDecorations = null; link.Foreground = color; TweetBlock.Inlines.Add(link); } catch (Exception) { TweetBlock.Inlines.Add(a); } } else { TweetBlock.Inlines.Add(a); } } } else { TweetBlock.Inlines.Add(new Run(HttpUtility.HtmlDecode(a))); } if (hasperiodend) { TweetBlock.Inlines.Add(new Run(HttpUtility.HtmlDecode("."))); } if (hascommaend) { TweetBlock.Inlines.Add(new Run(HttpUtility.HtmlDecode(","))); } TweetBlock.Inlines.Add(new Run(" ")); } else { TweetBlock.Inlines.Add(new Run(HttpUtility.HtmlDecode(a))); TweetBlock.Inlines.Add(new Run(" ")); } } #endregion if (moreusers) { label1.Text = "To: " + dbUser.UserDetails.ScreenName; } AtNameLabel.Text = "@" + Status.Sender.ScreenName; NameLabel.Text = Status.Sender.Name; generatePolygonAndMargins(Status.Text.Length, Status.Text.Trim().Replace("\n", " ")); loaded = true; GC.Collect(); } }
void DeviceIconPicker_Loaded(object sender, RoutedEventArgs e) { AeroGlassHelper.ExtendGlass(this, (int)windowContent.Margin.Left, (int)windowContent.Margin.Right, (int)windowContent.Margin.Top, (int)windowContent.Margin.Bottom); }
private void PeerDeviceProperties_Loaded(object sender, RoutedEventArgs e) { AeroGlassHelper.ExtendGlass(this, (int)windowContent.Margin.Left, (int)windowContent.Margin.Right, (int)windowContent.Margin.Top, (int)windowContent.Margin.Bottom); }
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); AeroGlassHelper.ExtendGlassFrame(this, new Thickness(-1)); }