public void CopyConfiguration(IWorkspace sourceWorkspace) { if (sourceWorkspace == null) { throw new ArgumentNullException("sourceWorkspace"); } if (sourceWorkspace == this) { throw new ArgumentException("Cannot copy configuration from itself.", "sourceWorkspace"); } Workspace workspace = sourceWorkspace as Workspace; if (workspace == null) { throw new ArgumentException("Source workspace must be of the type Workspace. Other types are not supported.", "sourceWorkspace"); } WindowProfileSerializer profileSerializer = this.CreateWindowProfileSerializer(); this.windowProfile = workspace.WindowProfile.Copy(this.name, profileSerializer); if (this.content == null) { return; } NakedView nakedView = (NakedView)this.windowProfile.Find((Predicate <ViewElement>)(v => v is NakedView)); if (nakedView == null) { return; } nakedView.Content = this.content; }
public bool LoadConfiguration(Stream config) { try { using (ViewElementFactory.Current.AllowConstruction()) this.windowProfile = (WindowProfile)XamlReader.Load(config); this.windowProfile.Name = this.name; if (!new ExpressionWindowProfileValidator().Validate(this.windowProfile)) { return(false); } if (this.content != null) { NakedView nakedView = (NakedView)this.windowProfile.Find((Predicate <ViewElement>)(v => v is NakedView)); if (nakedView != null) { nakedView.Content = this.content; } } return(true); } catch (Exception ex) { return(false); } }
public void createWindowProfile(int activeObjectID) { if (windowProfile == null) { windowProfile = new WindowProfile(WindowProfileType.Team); windowProfile.setLocalization(); if (activeObjectID == -1) { addToContext(); } else { addToContext(activeObjectID); } windowProfile.Owner = windowMain; windowProfile.Opacity = 0; windowProfile.Show(); windowProfile.Closed += new EventHandler(windowProfile_Closed); globalFuncs.FadeInElement(windowProfile, 0.5, globalFuncs.windowFinalOpacity, true); } else { if (activeObjectID == -1) { addToContext(); } else { addToContext(activeObjectID); } } }
private void ChangeSelectedWindowProfile(ComboBoxItem selectedItem) { try { WindowProfile profile = WindowProfile.Profile1; if (selectedItem.Content.ToString() == Toolbox.settings.WindowProfileName1) { profile = WindowProfile.Profile1; } else if (selectedItem.Content.ToString() == Toolbox.settings.WindowProfileName2) { profile = WindowProfile.Profile2; } else if (selectedItem.Content.ToString() == Toolbox.settings.WindowProfileName3) { profile = WindowProfile.Profile3; } else if (selectedItem.Content.ToString() == Toolbox.settings.WindowProfileName4) { profile = WindowProfile.Profile4; } uDebugLogAdd($"Starting window profile change: [comboItem] {selectedItem.Content.ToString()} [profile] {profile.ToString()}"); Toolbox.settings.ChangeWindowProfile(profile); } catch (Exception ex) { LogException(ex); } }
public ActionResult DeleteConfirmed(int id) { WindowProfile windowProfile = db.WindowsProfiles.Find(id); db.WindowsProfiles.Remove(windowProfile); db.SaveChanges(); return(RedirectToAction("Index")); }
protected virtual void PostValidateMainSite(MainSite site) { if (site.Find((Predicate <ViewElement>)(v => v is DocumentGroup)) != null) { return; } site.Child = WindowProfile.CreateDefaultMainSiteContent(); }
public override WindowProfile CreateWindowProfile(int x, int y, int width, int height) { WindowProfile aProfile = new WindowProfile(fName, WindowStyle.OverlappedWindow, ExtendedWindowStyle.OverLappedWindow, x, y, width, height); return aProfile; }
private void Setup() { using (var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("ModernApplicationFramework.Extended.Demo.Resources.DefaultProfile.winprf")) { var payload = LayoutPayloadUtilities.StreamToPlayloadData(stream); var profile = new WindowProfile("Default", payload); _profiles.Add("Default", profile); } }
public ActionResult Edit([Bind(Include = "WindowProfileID,CountCameras,Thickness,HeatResistanceCoefficient")] WindowProfile windowProfile) { if (ModelState.IsValid) { db.Entry(windowProfile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(windowProfile)); }
public virtual bool Validate(WindowProfile profile) { WindowProfileValidationContext validationContext = this.CreateValidationContext(); if (!this.ValidateOrReplaceViewElementCollection(profile.Children, validationContext)) { return(false); } this.PostValidation(profile, validationContext); return(true); }
public ActionResult Create([Bind(Include = "WindowProfileID,CountCameras,Thickness,HeatResistanceCoefficient")] WindowProfile windowProfile) { if (ModelState.IsValid) { db.WindowsProfiles.Add(windowProfile); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(windowProfile)); }
private void ChangeWindowProfile(WindowProfile profile) { try { Toolbox.settings.ChangeWindowProfile(profile); } catch (Exception ex) { LogException(ex); } }
public ActionResult Edit([Bind(Include = "WindowProfileID,ManufacturerWindowProfileID,TitleMark,CountCameras,Thickness,HeatResistanceCoefficient")] WindowProfile windowProfile) { if (ModelState.IsValid) { db.Entry(windowProfile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ManufacturerWindowProfileID = new SelectList(db.ManufacturerWindowProfiles, "ManufacturerWindowProfileID", "TitleCompany", windowProfile.ManufacturerWindowProfileID); return(View(windowProfile)); }
private void TriggerWindowProfileMove(WindowProfile profile) { try { uDebugLogAdd($"Triggering Windows Profile Move: {profile.ToString()}"); Actions.MoveProfileWindows(profile); } catch (Exception ex) { LogException(ex); } }
public void ChangeWindowProfile(WindowProfile windowProfile) { try { uDebugLogAdd($"Saving current window list for profile: {CurrentWindowProfile.ToString()}"); switch (CurrentWindowProfile) { case WindowProfile.Profile1: WindowProfile1 = ActiveWindowList; break; case WindowProfile.Profile2: WindowProfile2 = ActiveWindowList; break; case WindowProfile.Profile3: WindowProfile3 = ActiveWindowList; break; case WindowProfile.Profile4: WindowProfile4 = ActiveWindowList; break; } uDebugLogAdd($"Moving from WindowProfile {CurrentWindowProfile.ToString()} to {windowProfile.ToString()}"); CurrentWindowProfile = windowProfile; switch (windowProfile) { case WindowProfile.Profile1: ActiveWindowList = WindowProfile1; break; case WindowProfile.Profile2: ActiveWindowList = WindowProfile2; break; case WindowProfile.Profile3: ActiveWindowList = WindowProfile3; break; case WindowProfile.Profile4: ActiveWindowList = WindowProfile4; break; } uDebugLogAdd("Finished changing window profile"); Events.TriggerWindowInfoChange(); } catch (Exception ex) { Toolbox.LogException(ex); } }
// GET: WindowProfiles/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WindowProfile windowProfile = db.WindowsProfiles.Find(id); if (windowProfile == null) { return(HttpNotFound()); } return(View(windowProfile)); }
// GET: WindowProfiles/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WindowProfile windowProfile = db.WindowsProfiles.Find(id); if (windowProfile == null) { return(HttpNotFound()); } ViewBag.ManufacturerWindowProfileID = new SelectList(db.ManufacturerWindowProfiles, "ManufacturerWindowProfileID", "TitleCompany", windowProfile.ManufacturerWindowProfileID); return(View(windowProfile)); }
protected override void PostValidateMainSite(MainSite site) { if (site.Find((Predicate <ViewElement>)(v => { if (!(v is DocumentGroup)) { return(v is NakedView); } return(true); })) != null) { return; } site.Child = WindowProfile.CreateDefaultMainSiteContent(); }
protected virtual void PostValidation(WindowProfile profile, WindowProfileValidationContext context) { if (context.MainSites.Count == 0) { MainSite mainSite = MainSite.Create(); mainSite.Child = WindowProfile.CreateDefaultMainSiteContent(); profile.Children.Add((ViewElement)mainSite); } else { if (context.MainSites.Count > 1) { this.DeleteExtraMainSites(context.MainSites, profile); } foreach (MainSite site in context.MainSites) { this.PostValidateMainSite(site); } } }
private void ButtonSignUp_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(viewModel.Region)) { return; } if (string.IsNullOrEmpty(viewModel.SummonerName)) { return; } if (controller.GetSummoner(viewModel.Region, viewModel.SummonerName)) { WindowProfile profile = new WindowProfile(); profile.Show(); this.Close(); } else { MessageBox.Show("Not Found"); } }
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); IntPtr handle = new WindowInteropHelper((Window)this).Handle; ViewManager.Instance.Initialize(this._mainAera); ViewManager.Instance.FloatingWindowManager.OwnerWindow = handle; //停靠的偏好设置 ViewManager.Instance.Preferences.ShowAutoHiddenWindowsOnHover = false; ViewManager.Instance.Preferences.DocumentDockPreference = Microsoft.VisualStudio.PlatformUI.Shell.Preferences.DockPreference.DockAtEnd; ViewManager.Instance.Preferences.TabDockPreference = Microsoft.VisualStudio.PlatformUI.Shell.Preferences.DockPreference.DockAtEnd; ViewManager.Instance.Preferences.AllowDocumentTabAutoDocking = false; ViewManager.Instance.Preferences.AllowTabGroupTabAutoDocking = false; ViewManager.Instance.Preferences.EnableIndependentFloatingDocumentGroups = true; ViewManager.Instance.Preferences.EnableIndependentFloatingToolwindows = true; ViewManager.Instance.WindowProfile = WindowProfile.Create("DefaultWindowProfile"); }
private void DeleteExtraMainSites(List <MainSite> mainSites, WindowProfile profile) { MainSite mainSite1 = (MainSite)null; int num = 0; foreach (MainSite mainSite2 in mainSites) { List <ViewElement> list = new List <ViewElement>(mainSite2.FindAll((Predicate <ViewElement>)(v => v != null))); if (mainSite1 == null || list.Count > num) { mainSite1 = mainSite2; num = list.Count; } } mainSites.Remove(mainSite1); foreach (MainSite mainSite2 in mainSites) { profile.Children.Remove((ViewElement)mainSite2); } mainSites.Clear(); mainSites.Add(mainSite1); }
public static void MoveProfileWindows(WindowProfile profile) { try { uDebugLogAdd("Starting All Window Move"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); var workerCount = 0; List <WindowItem> chosenWindowList = null; string chosenProfileName = string.Empty; switch (profile) { case WindowProfile.Profile1: chosenWindowList = Toolbox.settings.WindowProfile1; chosenProfileName = Toolbox.settings.WindowProfileName1; break; case WindowProfile.Profile2: chosenWindowList = Toolbox.settings.WindowProfile2; chosenProfileName = Toolbox.settings.WindowProfileName2; break; case WindowProfile.Profile3: chosenWindowList = Toolbox.settings.WindowProfile3; chosenProfileName = Toolbox.settings.WindowProfileName3; break; case WindowProfile.Profile4: chosenWindowList = Toolbox.settings.WindowProfile4; chosenProfileName = Toolbox.settings.WindowProfileName4; break; default: chosenWindowList = Toolbox.settings.WindowProfile1; chosenProfileName = Toolbox.settings.WindowProfileName1; break; } foreach (var window in chosenWindowList.ToList()) { workerCount++; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (sender, e) => { try { MoveProcessHandle(window); } catch (Exception ex) { LogException(ex); } finally { workerCount--; } }; worker.RunWorkerAsync(); } BackgroundWorker verifyier = new BackgroundWorker() { WorkerReportsProgress = true }; verifyier.DoWork += (ws, we) => { while (workerCount != 0) { Thread.Sleep(100); } stopwatch.Stop(); uDebugLogAdd($"Finished All Window Move after {stopwatch.Elapsed.Seconds}s {stopwatch.Elapsed.Milliseconds}ms"); Director.Main.ShowNotification($"Moved all {chosenProfileName} windows"); }; verifyier.RunWorkerAsync(); } catch (Exception ex) { LogException(ex); } }
private void windowProfile_Closed(object sender, EventArgs e) { windowProfile.Closed -= new EventHandler(windowProfile_Closed); windowProfile = null; }
private void ButtonSignUp_OnClick(object sender, RoutedEventArgs e) { var profile = new WindowProfile(); profile.Show(); }
public WindowProfileCustomSerializer(WindowProfile profile) : base((IDependencyObjectCustomSerializerAccess)profile) { }
private void ButtonSignUp_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(viewModel.Region)) { return; } if (string.IsNullOrEmpty(viewModel.SummonerName)) { return; } if (string.IsNullOrEmpty(viewModel.GameMode)) { return; } if (controller.GetSummoner(viewModel.SummonerName)) { WindowProfile profile = new WindowProfile(); WindowTFT windowTFT = new WindowTFT(); switch (viewModel.GameMode.ToString()) { case "League Of Legends": profile.Show(); this.Close(); break; case "TeamFight Tatics": windowTFT.Show(); this.Close(); break; case "Legends of Runeterra": MessageBox.Show("Soon"); break; case "Valorant": MessageBox.Show("Soon"); break; case "LoL: Wild Rift": MessageBox.Show("Soon"); break; case "Project L": MessageBox.Show("Soon"); break; case "Project F": MessageBox.Show("Soon"); break; default: //MessageBox.Show("Follow me on Twitter @ree_gms"); profile.Show(); this.Close(); break; } } else { MessageBox.Show("Not Found"); } }