Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
 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);
         }
     }
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            WindowProfile windowProfile = db.WindowsProfiles.Find(id);

            db.WindowsProfiles.Remove(windowProfile);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
 protected virtual void PostValidateMainSite(MainSite site)
 {
     if (site.Find((Predicate <ViewElement>)(v => v is DocumentGroup)) != null)
     {
         return;
     }
     site.Child = WindowProfile.CreateDefaultMainSiteContent();
 }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
 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);
     }
 }
Ejemplo n.º 9
0
 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));
 }
Ejemplo n.º 10
0
        public virtual bool Validate(WindowProfile profile)
        {
            WindowProfileValidationContext validationContext = this.CreateValidationContext();

            if (!this.ValidateOrReplaceViewElementCollection(profile.Children, validationContext))
            {
                return(false);
            }
            this.PostValidation(profile, validationContext);
            return(true);
        }
Ejemplo n.º 11
0
        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));
        }
Ejemplo n.º 12
0
 private void ChangeWindowProfile(WindowProfile profile)
 {
     try
     {
         Toolbox.settings.ChangeWindowProfile(profile);
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
Ejemplo n.º 13
0
 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));
 }
Ejemplo n.º 14
0
 private void TriggerWindowProfileMove(WindowProfile profile)
 {
     try
     {
         uDebugLogAdd($"Triggering Windows Profile Move: {profile.ToString()}");
         Actions.MoveProfileWindows(profile);
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
Ejemplo n.º 15
0
        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);
            }
        }
Ejemplo n.º 16
0
        // 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));
        }
Ejemplo n.º 17
0
        // 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));
        }
Ejemplo n.º 18
0
 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();
 }
Ejemplo n.º 19
0
 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);
         }
     }
 }
Ejemplo n.º 20
0
        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");
            }
        }
Ejemplo n.º 21
0
        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");
        }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
        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);
            }
        }
Ejemplo n.º 24
0
 private void windowProfile_Closed(object sender, EventArgs e)
 {
     windowProfile.Closed -= new EventHandler(windowProfile_Closed);
     windowProfile         = null;
 }
Ejemplo n.º 25
0
        private void ButtonSignUp_OnClick(object sender, RoutedEventArgs e)
        {
            var profile = new WindowProfile();

            profile.Show();
        }
Ejemplo n.º 26
0
 public WindowProfileCustomSerializer(WindowProfile profile)
     : base((IDependencyObjectCustomSerializerAccess)profile)
 {
 }
Ejemplo n.º 27
0
        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");
            }
        }