public static Form CreateSubForm(string i_ClassName, User i_LoggedInUser, Album i_Album = null, AppMainForm i_MainForm = null) { if (i_ClassName == "buttonProfileForm") { SubForm = new ProfileForm(i_LoggedInUser, i_MainForm); } else if (i_ClassName == "buttonPostsForm") { SubForm = new PostsForm(i_LoggedInUser, i_MainForm); } else if (i_ClassName == "buttonEventsForm") { SubForm = new EventsForm(i_LoggedInUser); } else if (i_ClassName == "buttonAlbumsForm") { SubForm = new AlbumsForm(i_LoggedInUser, i_MainForm); } else if (i_ClassName == "buttonVideosForm") { SubForm = new VideosForm(i_LoggedInUser); } else if (i_ClassName == "buttonSettingsForm") { SubForm = new SettingsForm(i_LoggedInUser, i_MainForm); } else if (i_ClassName == "photosFormButtonLoader") { SubForm = new PhotosForm(i_LoggedInUser, i_Album, i_MainForm); } return(SubForm); }
private void metroTile1_Click(object sender, EventArgs e) { if (mainApp == null) mainApp = new AppMainForm(); mainApp.Show(); mainApp.WindowState = FormWindowState.Maximized; }
private void DisplayFormOnMainApp(Form form) { if (mainApp == null) mainApp = new AppMainForm(); mainApp.Show(); mainApp.ShowForm(form); mainApp.WindowState = FormWindowState.Maximized; }
public List<TabInfo> GetRibbonMenuTags() { //SmartThreadPool pool = new SmartThreadPool(); List<TabInfo> tags = new List<TabInfo>(); foreach (var downloader in Downloader.GetAllDownloaders()) { var attributes = downloader.GetType().GetCustomAttributes(typeof(DownloaderAttribute), true); if (attributes != null) { foreach (DownloaderAttribute att in attributes) { var tag = tags.Find(p => p.Name == att.MetroTab); if (tag == null) { tag = new TabInfo(); tags.Add(tag); } tag.Name = att.MetroTab; //global::System.Resources.ResourceManager resourceMan = new global::System.Resources.ResourceManager("ComicDownloader.Properties.Resources", typeof(ComicDownloader.Properties.Resources).Assembly); Thread.Sleep(new Random().Next(1,10)); var m = new Random(DateTime.Now.Millisecond); int next = m.Next(0, int.MaxValue); var title = new MetroFramework.Controls.MetroTile(); title.ActiveControl = null; title.Tag = downloader; title.Location = new System.Drawing.Point(20, 150); title.Cursor = System.Windows.Forms.Cursors.Hand; title.Size = new System.Drawing.Size(150, 120); title.CustomBackground = true; var index = next%colorArray.Length; title.BackColor = colorArray[index]; title.CustomForeColor = true; title.ForeColor = ColorTranslator.FromHtml("#ffffff"); title.TileTextFontSize = MetroTileTextSize.Medium; title.TileTextFontWeight = MetroTileTextWeight.Bold; //title.Style = (MetroFramework.MetroColorStyle)(next%13); title.TabIndex = 2; //if (title.Style == MetroColorStyle.White) title.Style = MetroColorStyle.Red; title.Text = downloader.Name; title.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; title.Theme = MetroFramework.MetroThemeStyle.Dark; title.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { var dl = ((MetroTile)sender).Tag as Downloader; if (mainApp == null) mainApp = new AppMainForm(); mainApp.Show(); mainApp.SetDownloader(dl); mainApp.WindowState = FormWindowState.Maximized; }); this.metroToolTip1.SetToolTip(title, downloader.Name); //pool.QueueWorkItem(delegate(object obj) { // TitleLogoUpdate data = (TitleLogoUpdate)obj; // if(!string.IsNullOrEmpty(data.Downloader.Logo) ){ // var img = data.Downloader.Logo.DownloadAsImage(); // img = img.Clip(data.Title.Width, data.Title.Height); // data.Title.TileImage = img; // data.Title.UseTileImage = true; // data.Title.TileImageAlign = ContentAlignment.MiddleCenter; // data.Title.TextAlign = ContentAlignment.BottomCenter; // } //}, //new TitleLogoUpdate() //{ // Title = title, // Downloader = downloader //}); //tag.Titles.Add(metroTile2); tag.Titles.Add(title); } } } // pool.Start(); return tags; }