コード例 #1
0
        public SkinInfo CreateSkin()
        {
            UILayer.UserGeneratedSkin.Path   = NEWOSUSKINPATH;
            UILayer.UserGeneratedSkin.Author = "OsuSkinRandomizer";
            Random rnd = new Random(); // generate "random" numbers so the skin will be randomized

            // create folder
            if (!System.IO.Directory.Exists(NEWOSUSKINPATH))
            {
                System.IO.Directory.CreateDirectory(NEWOSUSKINPATH);
            }

            foreach (string skinnableName in fileLogic.EVERYSKINNABLE)
            {
                // only match with the skins that have this skinnable => dont run into the "lol the skin doesnt have this file, but i tried to copy it anyway XD"
                List <SkinInfo> matches = UILayer.InstalledSkins.Where(x => x.AvailableSkinElements.Exists(y => y == skinnableName)).ToList();
                if (matches != null && matches.Count() > 1)
                {
                    SkinInfo chosenOne = matches[rnd.Next(0, matches.Count())];
                    UILayer.UserGeneratedSkin.AvailableSkinElements.Add(chosenOne.Path + "\\" + skinnableName);
                }
            }



            return(UILayer.UserGeneratedSkin);
        }
コード例 #2
0
		/// <summary>
		/// Default ctor
		/// </summary>
		public OkCancelDialog()
		{
			InitializeComponent();
			SkinInfo.ApplyColor(this);
			Application.Idle += OnIdle;

		}
コード例 #3
0
ファイル: SkinSection.cs プロジェクト: s1rcheese/osu
        private void addItem(SkinInfo item)
        {
            List <SkinInfo> newDropdownItems = skinDropdown.Items.Where(i => !i.Equals(item)).Append(item).ToList();

            sortUserSkins(newDropdownItems);
            skinDropdown.Items = newDropdownItems;
        }
コード例 #4
0
        private void ApplySkinSizeToWindow()
        {
            // in order to apply skin, player must be in the local machine

            try
            {
                SkinInfo skin    = GetCurrentSkin();
                Point    skinPos = new Point();

                if (!skin.GetName().Equals("None"))
                {
                    // move skin window to player window
                    Layout player        = _layout;
                    Screen currentScreen = Screen.AllScreens[_monitorId - 1];

                    skinPos.X = (int)((currentScreen.Bounds.Width * player.OriginX) / 1000.0f) - skin.VideoArea.OriginX + currentScreen.Bounds.Left;
                    skinPos.Y = (int)((currentScreen.Bounds.Height * player.OriginY) / 1000.0f) - skin.VideoArea.OriginY + currentScreen.Bounds.Top;

                    // set player size to fit
                    _layout.SizeX = (int)((skin.VideoArea.SizeX * 1000.0f) / currentScreen.Bounds.Width);
                    _layout.SizeY = (int)((skin.VideoArea.SizeY * 1000.0f) / currentScreen.Bounds.Height);
                }

                if (SkinInfoChanged != null)
                {
                    SkinInfoChanged(skin, skinPos);
                }
            }
            catch (System.Exception)
            {
            }
        }
コード例 #5
0
        public override void ParseSettingsFromString(string settingsLine)
        {
            try
            {
                string name  = ExtractSettingName(settingsLine);
                string value = ExtractSettingValue(settingsLine);

                if (name == Properties.Settings.Default.SettingNamePort)
                {
                    _port = uint.Parse(value);
                }
                else if (name == Properties.Settings.Default.SettingNameSkinfilename)
                {
                    _skin = SkinLoader.Instance.GetByName(value);
                }
                else if (name == Properties.Settings.Default.SettingNamePlayerIp)
                {
                    _ip = IPAddress.Parse(value);
                }
            }
            catch (System.Exception e)
            {
                MessageBox.Show("Error while loading settings\n" + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #6
0
        /// <summary>
        /// Helper method to read skins assigned at the three diferent levels: Portal, Tab, Module
        /// </summary>
        /// <param name="xml">Reference to xml document to create new elements</param>
        /// <param name="nodeToAdd">Node to add the skin information</param>
        /// <param name="skinRoot">Skin object to get: skins or containers</param>
        /// <param name="skinLevel">Skin level to get: portal, tab, module</param>
        /// <param name="id">ID of the object to get the skin. Used in conjunction with <paramref name="skinLevel"/> parameter.
        ///     Ex: if skinLevel is portal, <paramref="id"/> will be PortalID.
        /// </param>
        /// <remarks>
        /// Skin information nodes are added to <paramref="nodeToAdd"/> node.
        /// </remarks>
        /// <history>
        ///     [VMasanas]	23/09/2004	Created
        /// </history>
        private static void AddSkinXml(XmlDocument xml, XmlNode nodeToAdd, string skinRoot, string skinLevel, int id)
        {
            string elementprefix;

            if (skinRoot == SkinInfo.RootSkin)
            {
                elementprefix = "skin";
            }
            else
            {
                elementprefix = "container";
            }

            switch (skinLevel)
            {
            case "portal":

                SkinInfo skin = SkinController.GetSkin(skinRoot, id, SkinType.Portal);
                if (skin != null)
                {
                    XmlElement newnode = xml.CreateElement(elementprefix + "src");
                    newnode.InnerText = skin.SkinSrc;
                    nodeToAdd.AppendChild(newnode);
                }
                skin = SkinController.GetSkin(skinRoot, id, SkinType.Admin);
                if (skin != null)
                {
                    XmlElement newnode = xml.CreateElement(elementprefix + "srcadmin");
                    newnode.InnerText = skin.SkinSrc;
                    nodeToAdd.AppendChild(newnode);
                }
                break;
            }
        }
コード例 #7
0
 private void OnSkinInfoChanged(SkinInfo skin, Point position)
 {
     if (SkinInfoChangedEvent != null)
     {
         SkinInfoChangedEvent(skin, position);
     }
 }
コード例 #8
0
 public void MechanicChanged(int id)
 {
     mechanicID = id;
     skinInfo   = GameSettings.Instance.skinInfo[mechanicID];
     LoadSkins();
     SetSelectionsPos();
 }
コード例 #9
0
 /// <summary>
 /// 获取模板组信息
 /// </summary>
 void GetSkinInfo()
 {
     if (FileName != null)
     {
         string file = FileName;
         if (file != null && file != "" && File.Exists(Path.Combine(TemplateHelper.TemplateGroupPath, file)))
         {
             Data = TemplateHelper.GetSkinInfo(file);
             foreach (SkinInfo.SkinItem it in Data.Items)
             {
                 try
                 {
                     Template t = TemplateHelper.GetTemplate(it.Template + ".xml");
                     if (t != null)
                     {
                         it.TemplateText = t.Name;
                     }
                 }
                 catch
                 {
                     it.TemplateText = "";
                     Messages.ShowError("没有找到模板组" + file);
                 }
             }
             ShowSkinInfo();
         }
     }
 }
コード例 #10
0
    internal static List <SkinInfo> LoadSkins()
    {
        List <SkinInfo> skins = new List <SkinInfo>();

        IDbCommand dbcmd    = Instance.dbconn.CreateCommand();
        string     sqlQuery = "SELECT * " + "FROM Skins";

        dbcmd.CommandText = sqlQuery;
        IDataReader reader = dbcmd.ExecuteReader();

        while (reader.Read())
        {
            SkinInfo skin = new SkinInfo(reader.GetInt32(0));
            skin.skinSelected     = reader.GetInt32(1);
            skin.firstColor       = HexToColor(reader.GetString(2));
            skin.firstColorIndex  = reader.GetInt32(3);
            skin.secondColor      = HexToColor(reader.GetString(4));
            skin.secondColorIndex = reader.GetInt32(5);
            skin.spriteName       = reader.GetString(6);

            skins.Add(skin);
        }

        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;

        return(skins);
    }
コード例 #11
0
        public void Load()
        {
            try
            {
                StreamReader file = new StreamReader(Properties.Settings.Default.SettingsFilename);
                string       line = file.ReadLine();
                while (line != null)
                {
                    _playerSettings.ParseSettingsFromString(line);

                    line = file.ReadLine();
                }
            }
            catch (System.IO.FileNotFoundException)
            {
                // setting file does not exist, load defaults
                _playerSettings.Ip   = IPAddress.Loopback;
                _playerSettings.Port = 32000;

                SkinInfo skinNone = new SkinInfo();
                skinNone.ImageFilename       = "None";
                _playerSettings.SkinFilename = skinNone;
            }
            catch (System.Exception e)
            {
                System.Windows.Forms.MessageBox.Show("Error while loading settings.\n" + e.Message, "Error");
            }
        }
コード例 #12
0
        public SkinInfo GetTemplateGroup(string filename)
        {
            SkinInfo info = new SkinInfo();

            info.FromFile(TemplateGroupPath, filename);
            return(info);
        }
コード例 #13
0
ファイル: Files.cs プロジェクト: realTobby/OsuSkinRandomizer
        public List <SkinInfo> GetInstalledSkins(string osuSkinFolder)
        {
            List <SkinInfo> installedSkins = new List <SkinInfo>();

            string[] rawSkinDirectories = System.IO.Directory.GetDirectories(osuSkinFolder);

            foreach (string skinPath in rawSkinDirectories)
            {
                SkinInfo nextFoundSkin = new SkinInfo();

                if (System.IO.File.Exists(skinPath + "\\skin.ini"))
                {
                    // check for author
                    var skinINIContent = System.IO.File.ReadAllLines(skinPath + "\\skin.ini");
                    if (skinINIContent.Where(x => x.Contains("Author")).FirstOrDefault() != null)
                    {
                        nextFoundSkin.Author = skinINIContent.Where(x => x.Contains("Author")).FirstOrDefault().Replace("Author:", string.Empty);
                    }
                    else
                    {
                        nextFoundSkin.Author = " NOT DEFINED";
                    }
                }
                else
                {
                    nextFoundSkin.Author = " NO SKIN INI";
                }

                nextFoundSkin.Path     = skinPath;
                nextFoundSkin.SkinName = skinPath.Split('\\').Last();
                installedSkins.Add(nextFoundSkin);
            }
            return(installedSkins);
        }
コード例 #14
0
ファイル: content.Master.cs プロジェクト: jiaping/JPCMS
 /// <summary>
 /// 重建所有索引
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ReIndexHyperLink_Click(object sender, EventArgs e)
 {
     try
     {
         //部件,主题索引
         BaseControlHelper baseCtrlHelper = new BaseControlHelper();
         baseCtrlHelper.CreateThemeIndex();
         baseCtrlHelper.CreateWidegetsIndex();
         //模板图索引
         SiteSettingHelper siteSettingHelper    = new SiteSettingHelper();
         TemplateHelper    TemplateHelper       = new TemplateHelper();
         string            defaultTempGroupFile = siteSettingHelper.Config.DefaultTemplateGroupFileName;
         if (!string.IsNullOrEmpty(defaultTempGroupFile) &&
             File.Exists(Path.Combine(TemplateHelper.TemplateGroupPath, defaultTempGroupFile)))
         {
             SkinInfo data = TemplateHelper.GetSkinInfo(defaultTempGroupFile);
             TemplateHelper.CreateMapFileFromSkinInfo(data);
             TemplateHelper.RefreshTemplateDefaultBindText(data);
         }
     }
     catch (Exception ex)
     {
         We7.Framework.LogHelper.WriteLog(typeof(content), ex);
     }
 }
コード例 #15
0
    public void ReplaceSkin(SkinInfo newValue)
    {
        var index     = GameComponentsLookup.Skin;
        var component = (SkinComponent)CreateComponent(index, typeof(SkinComponent));

        component.value = newValue;
        ReplaceComponent(index, component);
    }
コード例 #16
0
    public void Init(SkinShopPanel owner, SkinInfo info)
    {
        this.owner       = owner;
        this.Info        = info;
        thumbnail.Sprite = info.Thumbnail;

        Refresh();
    }
コード例 #17
0
 /// <summary>
 /// 刷新模板组中所有模板信息中的冗余字段 DefaultBindText
 /// </summary>
 public void RefreshTemplateDefaultBindText(SkinInfo skin)
 {
     Template[] tps = GetTemplates(null, Path.GetFileNameWithoutExtension(skin.FileName));
     foreach (Template t in tps)
     {
         RefreshOneTempplateBindText(skin, t);
     }
 }
コード例 #18
0
    public void SetColorD()
    {
        playerType   = SkinInfo.SkinType.SKIN_TYPE_03;
        playerColor  = colors[3];
        player.color = colors[3];

        SkinInfo.SetSkinInfo(SkinInfo.SkinType.SKIN_TYPE_03, colors[3]);
        AudioManager.PlaySE(AudioManager.AudioSourceIndex.AUDIO_SOURCE_SE_TYPE_A, AudioManager.SE.SE_TITLE, 0.5f);
    }
コード例 #19
0
        private void itemAdded(SkinInfo s, bool existing, bool silent)
        {
            if (existing)
            {
                return;
            }

            Schedule(() => skinDropdown.Items = skinDropdown.Items.Append(s).ToArray());
        }
コード例 #20
0
        public PlayerSettings()
        {
            // set defaults
            _ip   = IPAddress.Loopback;
            _port = Properties.Settings.Default.DefaultCommunicationPort;

            // TODO, load proper skin
            _skin = new SkinInfo();
        }
コード例 #21
0
        private void OnSkinInfoChangedEvent(SkinInfo skin, Point position)
        {
            if (!skin.GetName().Equals("None"))
            {
                _skinForm.Top  = position.Y;
                _skinForm.Left = position.X;
            }

            _skinForm.SetSkin(skin);
        }
コード例 #22
0
        /// <summary>
        /// 保存模板绑定项
        /// </summary>
        /// <param name="bc"></param>
        /// <param name="skinFolder"></param>
        /// <param name="templateFile"></param>
        public void SaveTemplateBind(TemplateBindConfig bc, string skinFolder, string templateFile)
        {
            if (bc != null)
            {
                string handler = bc.Handler;
                string mode    = bc.Mode;
                string model   = bc.Model;
                bc = GetTemplateConfigSentence(bc);

                SkinInfo          tg   = GetSkinInfo(skinFolder + ".xml");//读取模板信息
                SkinInfo.SkinItem item = new SkinInfo.SkinItem();
                Template          tp   = GetTemplate(templateFile);
                if (tp != null)
                {
                    item.TemplateText = tp.Name;
                    item.Name         = tp.Name;
                    item.Description  = tp.Description;
                    item.Template     = tp.FileName;
                    if (handler == "model" && !string.IsNullOrEmpty(model))
                    {
                        ModelInfo mi = ModelHelper.GetModelInfoByName(model);
                        if (mi != null)
                        {
                            item.C_Model     = model;
                            item.C_ModelText = mi.Label;
                        }
                        else
                        {
                            throw new Exception("没有找到模型的信息文件,请重建内容模型索引再试。");
                        }
                    }

                    item.Location     = mode;
                    item.LocationText = bc.HandlerName + bc.ModeText;
                    item.Tag          = "";
                    item.Type         = handler;
                    if (!HaveSameItem(item, tg))
                    {
                        tg.Items.Add(item);
                        string sentence = item.C_ModelText + item.LocationText;
                        string fn       = SaveSkinInfoAndPreviewFile(tg, Path.GetFileNameWithoutExtension(skinFolder));
                        CreateMapFileFromSkinInfo(tg);
                        RefreshOneTempplateBindText(tg, tp);
                    }
                    else
                    {
                        throw new Exception("对不起,已经存在相同的绑定项,不能重复增加!如想修改绑定项,请先删除旧的再试。");
                    }
                }
                else
                {
                    throw new Exception("无法保存!不存在模板文件“" + templateFile + "”!");
                }
            }
        }
コード例 #23
0
 public void SetCurrentSkin(SkinInfo skin)
 {
     foreach (var item in _skins)
     {
         if (item.GetName().Equals(skin.GetName()))
         {
             // skin found, apply it
             SkinsListBox.SelectedIndex = SkinsListBox.FindString(item.GetName());
         }
     }
 }
コード例 #24
0
 protected void CreateSkinTest(SkinInfo gameCurrentSkin, Func <ISkin> getBeatmapSkin)
 {
     CreateTest(() =>
     {
         AddStep("setup skins", () =>
         {
             skinManager.CurrentSkinInfo.Value = gameCurrentSkin;
             currentBeatmapSkin = getBeatmapSkin();
         });
     });
 }
コード例 #25
0
ファイル: Skin.cs プロジェクト: swordlegend/chess-and-card
 public void ClearResources()
 {
     if (this._uiTex != null && this._uiTex.mainTexture != null)
     {
         this._uiTex.mainTexture = null;
     }
     if (this._skinInfo != null)
     {
         this._skinInfo = null;
     }
 }
コード例 #26
0
        private void MultiMediaPlayerFormVisibleChanged(object sender, EventArgs e)
        {
            if (!this.Visible)
            {
                _playerCommunicatorControl.NotifyHide();

                SkinInfo noneSkin = new SkinInfo();
                noneSkin.ImageFilename = "None";
                _skinForm.SetSkin(noneSkin);
            }
        }
コード例 #27
0
        private void assertCorrectMetadata(SkinInfo import1, string name, string creator, OsuGameBase osu)
        {
            Assert.That(import1.Name, Is.EqualTo(name));
            Assert.That(import1.Creator, Is.EqualTo(creator));

            // for extra safety let's reconstruct the skin, reading from the skin.ini.
            var instance = import1.CreateInstance((IStorageResourceProvider)osu.Dependencies.Get(typeof(SkinManager)));

            Assert.That(instance.Configuration.SkinInfo.Name, Is.EqualTo(name));
            Assert.That(instance.Configuration.SkinInfo.Creator, Is.EqualTo(creator));
        }
コード例 #28
0
        /// <summary>
        /// 根据模板组文件生成模版地图
        /// </summary>
        /// <param name="skinInfo"></param>
        public void CreateMapFileFromSkinInfo(SkinInfo skinInfo)
        {
            string      templatesMapFile = HttpContext.Current.Server.MapPath("~/_skins/templates.map");
            TemplateMap tm = new TemplateMap(templatesMapFile);

            tm.Maps.Clear();
            tm.Maps = TemplateMap.CreateMapList(skinInfo.Items);

            TemplateMap.SaveToMapFile(tm.Maps, templatesMapFile);
            TemplateMap.ResetInstance();
        }
コード例 #29
0
        /// <summary>
        /// 无缓存获取皮肤信息
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public SkinInfo GetSkinInfoFromFile(string fileName)
        {
            SkinInfo skinInfo = new SkinInfo();

            if (!fileName.ToLower().EndsWith(".xml"))
            {
                fileName += ".xml";
            }
            skinInfo.FromFile(SkinPath, fileName);
            return(skinInfo);
        }
コード例 #30
0
        public string SaveSkinInfoAndPreviewFile(SkinInfo data, string foldername)
        {
            if (data.FileName == null)
            {
                data.Created  = DateTime.Now;
                data.FileName = string.Format("{0}.xml", foldername);
            }
            data.ToFile(TemplateGroupPath, data.FileName);
            ClearSkinInfoCache(data.FileName);

            return(data.FileName);
        }
コード例 #31
0
 public static List<SkinInfo> GetInstalledSkins()
 {
     List<SkinInfo> list = new List<SkinInfo>();
     foreach (string folder in Directory.GetDirectories(Path.Combine(Globals.HostMapPath, "Skins")))
     {
         if (!folder.EndsWith(Globals.glbHostSkinFolder))
         {
             SkinInfo skin = new SkinInfo();
             skin.SkinName = folder.Substring(folder.LastIndexOf("\\") + 1);
             skin.InUse = isFallbackSkin(folder) || !SkinController.CanDeleteSkin(folder, "");
             list.Add(skin);
         }
     }
     return list;
 }
コード例 #32
0
        public override MeshContainer CreateMeshContainer(string name, MeshData meshData, ExtendedMaterial[] materials, EffectInstance[] effectInstances, int[] adjacency, SkinInfo skinInfo)
        {
            CustomMeshContainer meshContainer = new CustomMeshContainer();
            meshContainer.Name = name;
            meshContainer.MeshData = meshData;

            meshContainer.SetAdjacency(adjacency);
            meshContainer.SetEffects(effectInstances);

            meshContainer.SkinInfo = skinInfo;
            meshContainer.OriginalMesh = meshData.Mesh.Clone(meshData.Mesh.Device, meshData.Mesh.CreationOptions, meshData.Mesh.VertexFormat);

            if (skinInfo != null)
            {
                meshContainer.BoneOffsets = new Matrix[skinInfo.BoneCount];
                for (int i = 0; i < skinInfo.BoneCount; i++)
                    meshContainer.BoneOffsets[i] = skinInfo.GetBoneOffsetMatrix(i);
                meshContainer.PaletteEntries = Math.Min(MaxMatrices, meshContainer.SkinInfo.BoneCount);

                int influences;
                BoneCombination[] boneCombinations;

                meshContainer.MeshData.Mesh.Dispose();
                meshContainer.MeshData = new MeshData(meshContainer.SkinInfo.ConvertToIndexedBlendedMesh(meshContainer.OriginalMesh, meshContainer.PaletteEntries,
                    adjacency, out influences, out boneCombinations));
                meshContainer.Influences = influences;
                meshContainer.BoneCombinations = boneCombinations;

                VertexElement[] elements = meshContainer.MeshData.Mesh.GetDeclaration();
                for (int i = 0; i < elements.Length; i++)
                {
                    if (elements[i].Stream == 0xff)
                        break;

                    if (elements[i].Usage == DeclarationUsage.BlendIndices && elements[i].UsageIndex == 0)
                        elements[i].Type = DeclarationType.Color;
                }

                meshContainer.MeshData.Mesh.UpdateSemantics(elements);
            }

            return meshContainer;
        }
コード例 #33
0
        private void UnregisterFromHighlighter( SkinInfo skinInfo )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            if( Highlighter.Status.IsStartingOrStarted )
            {
                Highlighter.Service.UnregisterTree( skinInfo.NameKeyboard, skinInfo.ViewModel.KeyboardVM );
            }
        }
コード例 #34
0
        // when we call this function, we must remove the skin from the dictionary
        void UninitializeActiveWindows( SkinInfo skin )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            //Setting the config is done after closing the window because modifying a value in the Config
            //Triggers a Caliburn Micro OnNotifyPropertyChanged, which calls an Invoke on the main UI Thread.
            //generating random locks.
            //Once the LayoutManager is ready, we won't need this anymore.
            WINDOWPLACEMENT placement = new WINDOWPLACEMENT();

            UnregisterSkinEvents( skin );
            Unsubscribe( skin );
            UnregisterFromHighlighter( skin );
            UnregisterTopMostService( skin );

            placement = CKWindowTools.GetPlacement( skin.Skin.Hwnd );

            skin.ViewModel.Dispose();

            if( _skins.Count == 1 && _miniView != null && _miniView.Visibility != Visibility.Hidden )
            {
                if( Highlighter.Status.IsStartingOrStarted )
                    Highlighter.Service.UnregisterTree( _miniViewVm.Name, _miniViewVm );

                _miniView.Hide();
                _viewHidden = false;
            }

            //temporary 03/03/2014
            if( !skin.IsClosing )
            {
                skin.IsClosing = true;
                skin.Skin.Dispatcher.Invoke( (Action)(() =>
                {
                    skin.Skin.Close();
                }) );
            }

            Config.User.Set( PlacementString( skin ), placement );
        }
コード例 #35
0
 void Subscribe( SkinInfo skinInfo )
 {
     skinInfo.Subscriber.Subscribe( skinInfo.NameKeyboard, skinInfo.Skin );
 }
コード例 #36
0
        private void SetWindowPlacement( SkinInfo skinInfo )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            var defaultPlacement = new WINDOWPLACEMENT();
            defaultPlacement = CKWindowTools.GetPlacement( skinInfo.Skin.Hwnd );
            WINDOWPLACEMENT actualPlacement = Config.User.GetOrSet( PlacementString( skinInfo ), defaultPlacement );

            skinInfo.Dispatcher.Invoke( (Action)(() => CKWindowTools.SetPlacement( skinInfo.Skin.Hwnd, actualPlacement )), null );
        }
コード例 #37
0
        /// <summary>
        /// Must be called from the skin thread
        /// </summary>
        private void SetDefaultWindowPosition( SkinInfo skinInfo, int defaultWidth, int defaultHeight )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == skinInfo.Dispatcher, "This method should only be called by the window's dispatcher." );

            skinInfo.Skin.Top = 0;
            skinInfo.Skin.Left = 0;
            skinInfo.Skin.Width = defaultWidth;
            skinInfo.Skin.Height = defaultHeight;
        }
コード例 #38
0
 void RegisterTopMostService( SkinInfo skinInfo )
 {
     if( TopMostService.Status == InternalRunningStatus.Started )
     {
         TopMostService.Service.RegisterTopMostElement( "10", skinInfo.Skin );
     }
 }
コード例 #39
0
        private void RegisterHighlighter( SkinInfo skinInfo )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            if( Highlighter.Status == InternalRunningStatus.Started )
            {
                Highlighter.Service.RegisterTree( skinInfo.NameKeyboard, skinInfo.NameKeyboard,
                    new ExtensibleHighlightableElementProxy( skinInfo.NameKeyboard, skinInfo.ViewModel.KeyboardVM, true ) );
            }
        }
コード例 #40
0
 void Unsubscribe( SkinInfo skinInfo )
 {
     skinInfo.Subscriber.Unsubscribe();
 }
コード例 #41
0
        private void UnregisterSkinEvents( SkinInfo skinInfo )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            //temporary 03/03/2014
            skinInfo.Skin.StateChanged -= OnStateChanged;

            skinInfo.Skin.Closing -= new CancelEventHandler( OnWindowClosing );
        }
コード例 #42
0
        void UnregisterTopMostService( SkinInfo skinInfo )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            if( TopMostService.Status == InternalRunningStatus.Started )
            {
                //skinInfo.Dispatcher.BeginInvoke( new Action( () =>
                //{
                TopMostService.Service.UnregisterTopMostElement( skinInfo.Skin );
                //} ) );
            }
        }
コード例 #43
0
        void InitializeActiveWindow( IKeyboard keyboard )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            var vm = new VMContextActiveKeyboard( NoFocusManager, keyboard.Name, Context, KeyboardContext.Service.Keyboards.Context, Config );
            var subscriber = new WindowManagerSubscriber( WindowManager, WindowBinder );

            var skin = NoFocusManager.CreateNoFocusWindow<SkinWindow>( nfm => new SkinWindow( nfm )
            {
                DataContext = vm
            } );

            SkinInfo skinInfo = new SkinInfo( skin, vm, NoFocusManager.NoFocusDispatcher, subscriber );
            _skins.Add( keyboard.Name, skinInfo );

            InitializeWindowLayout( skinInfo );
            skinInfo.Dispatcher.Invoke( (Action)(() =>
            {
                skinInfo.Skin.Show();
                skinInfo.Skin.ShowInTaskbar = false;
            }) );
            SetWindowPlacement( skinInfo );

            Subscribe( skinInfo );
            RegisterHighlighter( skinInfo );
            RegisterTopMostService( skinInfo );

            RegisterSkinEvents( skinInfo );
        }
コード例 #44
0
        /// <summary>
        /// Must be called from the skin thread
        /// </summary>
        private void InitializeWindowLayout( SkinInfo skinInfo )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            int defaultWidth = skinInfo.ViewModel.KeyboardVM.W;
            int defaultHeight = skinInfo.ViewModel.KeyboardVM.H;

            if( !Config.User.Contains( PlacementString( skinInfo ) ) )
            {
                var viewPortSize = Config[skinInfo.ViewModel.KeyboardVM.Layout]["ViewPortSize"];

                skinInfo.Skin.Dispatcher.Invoke( (Action)(() =>
                {
                    if( viewPortSize != null )
                    {
                        Size size = (Size)viewPortSize;
                        SetDefaultWindowPosition( skinInfo, (int)size.Width, (int)size.Height );
                    }
                    else
                        SetDefaultWindowPosition( skinInfo, defaultWidth, defaultHeight ); //first launch : places the skin in the default position
                }) );
            }
            else
            {
                skinInfo.Skin.Dispatcher.Invoke( (Action)(() =>
                {
                    skinInfo.Skin.Width = skinInfo.Skin.Height = 0; //After the first launch : hiding the window to get its last placement from the user conf.
                }) );
            }
        }
コード例 #45
0
        string PlacementString( SkinInfo skinInfo )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );

            if( skinInfo.ViewModel.KeyboardVM != null && skinInfo.ViewModel.KeyboardVM.Keyboard != null )
                return skinInfo.ViewModel.KeyboardVM.Keyboard.Name + ".WindowPlacement";

            return String.Empty;
        }
コード例 #46
0
        public void loadSkin(string key, MemoryStream stream)
        {
            if (skin_list.ContainsKey(key) == false)
              {
            //System.Diagnostics.Debugger.Launch();
            StreamReader reader = new StreamReader(stream);
            string text_file = reader.ReadToEnd();
            reader.Close();
            stream.Close();

            char[] separator = { ',', '\n' };
            string[] string_parts = text_file.Split(separator);
            //push textures info
            SkinInfo skin_info = new SkinInfo();
            skin_info.textures_info = new List<TextureInfo>();
            for (int i = 0; i + 1 < string_parts.Length; i += 2)
            {
              TextureInfo t_info = new TextureInfo();
              t_info.mesh_name = string_parts[i].Replace('\r', ' ');
              t_info.texture_name = string_parts[i + 1].Replace('\r', ' ');
              //System.Diagnostics.Debugger.Launch();
              t_info.texture_name = t_info.texture_name.Trim();

              if (t_info.texture_name.Length > 1 && t_info.mesh_name.Length > 1)
              {
            t_info.texture_name = Path.GetFileName(t_info.texture_name).Trim();
            skin_info.textures_info.Add(t_info);
              }
            }
            skin_list.Add(key, skin_info);
              }
        }
コード例 #47
0
            public void Draw(Graphics g, SkinInfo skin, Form form, bool active)
            {
                if (MouseIn)
                {
                    s_genBrush.Color = skin.CaptionButtonHoverColor;
                    g.FillRectangle(s_genBrush, Bound);
                }
                else
                {
                    s_genBrush.Color = skin.TitleBarBackColor;
                }

                s_genPen.Color = active ? skin.ActiveTitleBarForeColor
                    : skin.TitleBarForeColor;

                int margin = (int)(Bound.Height * 0.3f);
                Rectangle rect = Bound;
                rect.Inflate(-margin, -margin);


                if (Id == HitTest.HTCLOSE)
                {
                    var smoothMode = g.SmoothingMode;
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    s_genPen.Width = 2.0f;
                    g.DrawLine(s_genPen, rect.X, rect.Y, rect.Right, rect.Bottom);
                    g.DrawLine(s_genPen, rect.Right, rect.Y, rect.X, rect.Bottom);
                    g.SmoothingMode = smoothMode;
                }
                else if (Id == HitTest.HTMAXBUTTON)
                {
                    s_genPen.Width = 1.0f;
                    if (form.WindowState == FormWindowState.Normal)
                    {
                        g.DrawRectangle(s_genPen, rect);
                        g.DrawLine(s_genPen, rect.X, rect.Y + 1, rect.Right, rect.Y + 1);
                    }
                    else
                    {
                        Rectangle rect2 = rect;

                        rect2.X += margin / 2;
                        rect2.Y -= margin / 2;

                        g.DrawRectangle(s_genPen, rect2);
                        g.DrawLine(s_genPen, rect2.X, rect2.Y + 1, rect2.Right, rect2.Y + 1);

                        rect2.X -= margin / 2;
                        rect2.Y += margin / 2;

                        g.FillRectangle(s_genBrush, rect2);
                        g.DrawRectangle(s_genPen, rect2);
                        g.DrawLine(s_genPen, rect2.X, rect2.Y + 1, rect2.Right, rect2.Y + 1);
                    }

                }
                else if (Id == HitTest.HTMINBUTTON)
                {
                    s_genPen.Width = 2;
                    g.DrawLine(s_genPen, rect.X, rect.Bottom, rect.Right, rect.Bottom);
                }
            }