Esempio n. 1
0
        public async Task <CharacterExtended> SetCharacterFrom(CharacterShared mySINner)
        {
            InitializeComponent();
            _mySINner = mySINner;
            //if (PluginHandler.MyCharExtendedDic.ContainsKey(mySINner.CharacterObject.FileName))
            //{
            //    CharacterExtended outce;
            //    if (!PluginHandler.MyCharExtendedDic.TryGetValue(mySINner.CharacterObject.FileName, out outce))
            //    {
            //        throw new ArgumentException("Could not get character from MyCharExtendedDic", nameof(mySINner));
            //    }

            //    MyCE = outce;
            //}
            //else
            //{
            MyCE             = new CharacterExtended(mySINner.CharacterObject, null, PluginHandler.MySINnerLoading);
            MyCE.ZipFilePath = await MyCE.PrepareModel();

            //}
            MyCE.MySINnerFile.SiNnerMetaData.Tags = MyCE.PopulateTags();

            TabSINnersBasic = new ucSINnersBasic(this)
            {
                Visible = true
            };
            TabSINnersAdvanced = new ucSINnersAdvanced(this)
            {
                Visible = true
            };


            this.tabPageBasic.Controls.Add(TabSINnersBasic);
            this.tabPageAdvanced.Controls.Add(TabSINnersAdvanced);

            this.AutoSize = true;

            return(MyCE);
        }
        public async Task <CharacterExtended> SetCharacterFrom(CharacterShared mySINner)
        {
            InitializeComponent();
            _mySINner        = mySINner;
            MyCE             = new CharacterExtended(mySINner.CharacterObject, null, PluginHandler.MySINnerLoading);
            MyCE.ZipFilePath = await MyCE.PrepareModel();

            MyCE.MySINnerFile.SiNnerMetaData.Tags = MyCE.PopulateTags();

            TabSINnersBasic = new ucSINnersBasic(this)
            {
                Visible = true
            };
            TabSINnersAdvanced = new ucSINnersAdvanced(this)
            {
                Visible = true
            };


            this.tabPageBasic.Controls.Add(TabSINnersBasic);
            this.tabPageAdvanced.Controls.Add(TabSINnersAdvanced);

            this.AutoSize = true;

            if ((ucSINnersOptions.UploadOnSave == true))
            {
                try
                {
                    mySINner.CharacterObject.OnSaveCompleted  = null;
                    mySINner.CharacterObject.OnSaveCompleted += PluginHandler.MyOnSaveUpload;
                }
                catch (Exception e)
                {
                    System.Diagnostics.Trace.TraceInformation(e.ToString());
                }
            }
            return(MyCE);
        }
        public async Task <CharacterExtended> SetCharacterFrom(CharacterShared mySINner)
        {
            InitializeComponent();
            _mySINner        = mySINner ?? throw new ArgumentNullException(nameof(mySINner));
            MyCE             = new CharacterExtended(mySINner.CharacterObject, PluginHandler.MySINnerLoading);
            MyCE.ZipFilePath = await MyCE.PrepareModelAsync();

            TabSINnersBasic = new ucSINnersBasic(this)
            {
                Visible = true
            };
            TabSINnersAdvanced = new ucSINnersAdvanced(this)
            {
                Visible = true
            };


            tabPageBasic.Controls.Add(TabSINnersBasic);
            tabPageAdvanced.Controls.Add(TabSINnersAdvanced);
            AutoSize = true;

            if (ucSINnersOptions.UploadOnSave)
            {
                try
                {
                    if (await mySINner.CharacterObject.DoOnSaveCompletedAsync.RemoveAsync(PluginHandler.MyOnSaveUpload))
                    {
                        await mySINner.CharacterObject.DoOnSaveCompletedAsync.AddAsync(PluginHandler.MyOnSaveUpload);
                    }
                }
                catch (Exception e)
                {
                    Log.Warn(e);
                }
            }
            //MyCE.MySINnerFile.SiNnerMetaData.Tags = MyCE.PopulateTags();
            return(MyCE);
        }