Beispiel #1
0
        public LinkGroupFilterable OpenSubGroup(string groupKey, string displayName, Uri uri, int limit = 2)
        {
            var groupLinks   = MenuLinkGroups.OfType <LinkGroupFilterable>().Where(x => x.GroupKey == groupKey).ToList();
            var existingLink = groupLinks.FirstOrDefault(x => x.Source == uri);

            if (existingLink == null)
            {
                existingLink = new LinkGroupFilterable {
                    DisplayName = displayName,
                    GroupKey    = groupKey,
                    Source      = uri
                };

                while (groupLinks.Count >= limit)
                {
                    MenuLinkGroups.Remove(groupLinks[0]);
                    groupLinks.RemoveAt(0);
                }

                groupLinks.Add(existingLink);
                MenuLinkGroups.Add(existingLink);

                if (!_subGroupKeys.Contains(groupKey))
                {
                    _subGroupKeys.Add(groupKey);
                    ValuesStorage.Set(KeySubGroupKeys, _subGroupKeys);
                }

                ValuesStorage.Set(GetSubGroupLinksKey(groupKey),
                                  groupLinks.Select(x => Storage.EncodeList(x.DisplayName, x.Source.OriginalString)));
            }

            NavigateTo(uri);
            return(existingLink);
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();
            System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon();
            ni.Icon         = new System.Drawing.Icon("LOGO-ICON.ico");
            ni.Visible      = true;
            ni.DoubleClick +=
                delegate(object sender, EventArgs args)
            {
                this.Show();
                this.WindowState = WindowState.Normal;
            };

            ni.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
            ni.ContextMenuStrip.Items.Add("Show", null, (s, e) => {
                this.Show();
            });
            ni.ContextMenuStrip.Items.Add("Exit", null, (s, e) => {
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            });


            Closing += (s, e) => {
                e.Cancel = true;
                this.Hide();
            };

            if (string.IsNullOrWhiteSpace(Properties.Settings.Default.Path))
            {
                MenuLinkGroups.Remove(uploadtab);
            }
            else
            {
                UploadTabAdded = true;
            }
        }