예제 #1
0
        public ValorRewardController()
            : base(0xEDC)
        {
            Name         = "Rewards Controller";
            Movable      = false;
            Visible      = false;
            MTitle       = new TitleCollection();
            _mValorItems = new ValorItemCollection();
            Categories   = new Dictionary <int, string>
            {
                { 0, "Titles" }
            };

            if (_mInstance != null)
            {
                // there can only be one RewardController game stone in the world
                _mInstance.Location = Location;
                CommandHandlers.BroadcastMessage(
                    AccessLevel.GameMaster, 0x489, "Existing Title Controller has been moved to this location (DON'T DELETE IT!).");
                Timer.DelayCall(TimeSpan.FromSeconds(1), UpdateInstancePosition, this);
            }
            else
            {
                _mInstance = this;
            }
        }
예제 #2
0
        protected virtual void Dispose(bool isdisposable)
        {
            GridCutCommand           = null;
            GridCopyCommand          = null;
            GridPasteCommand         = null;
            DeleteCommand            = null;
            ExpandAllCommand         = null;
            CollapseAllCommand       = null;
            SortAscendingCommand     = null;
            SortDescendingCommand    = null;
            ClearSummaryCommand      = null;
            GroupColumnCommand       = null;
            ShowGroupDropAreaCommand = null;
            ClearSortingCommand      = null;
            ClearFilteringCommand    = null;
            ClearGroupingCommand     = null;
            if (Employees != null)
            {
                foreach (var employee in Employees)
                {
                    (employee as Employee).Dispose();
                }
                Employees.Clear();
            }

            if (TitleCollection != null)
            {
                TitleCollection.Clear();
            }
        }
예제 #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            MTitle       = new TitleCollection();
            _mValorItems = new ValorItemCollection();
            switch (version)
            {
            case 2:
            {
                int categoryCount = reader.ReadInt();

                if (categoryCount > 0)
                {
                    Categories = new Dictionary <int, string>();

                    for (int i = 0; i < categoryCount; i++)
                    {
                        int    num   = reader.ReadInt();
                        string title = reader.ReadString();
                        Categories.Add(num, title);
                    }
                }
                goto case 1;
            }

            case 1:
            {
                int count = reader.ReadInt();
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        var r = (ValorItem)reader.ReadItem();
                        _mValorItems.Add(r);
                    }
                }
                goto case 0;
            }

            case 0:
            {
                int count = reader.ReadInt();
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        var r = (ValorTitleItem)reader.ReadItem();
                        MTitle.Add(r);
                    }
                }
            }
                _mInstance = this;
                break;
            }
        }
 public static void ClearFast(this TitleCollection collection)
 {
     collection.SuspendUpdates();
     while (collection.Count > 0)
     {
         collection.RemoveAt(collection.Count - 1);
     }
     collection.ResumeUpdates();
 }
예제 #5
0
        public OMLDatabaseEditor()
        {
            TitleCollection.checkACL();

            OMLEngine.Utilities.RawSetup();

            InitializeComponent();
            InitData();
            LoadImportPlugins(PluginTypes.ImportPlugin, _importPlugins);
            LoadMetadataPlugins(PluginTypes.MetadataPlugin, _metadataPlugins);
            SetupPluginList();
        }
예제 #6
0
        /// <summary>
        /// 获取收藏资讯
        /// </summary>
        private void GetData()
        {
            if (settings.Contains("Titles"))
            {
                TitleCollection.Clear();
                string[] titleStr = settings["Titles"].ToString().Split(';');

                foreach (var s in titleStr)
                {
                    if (!string.IsNullOrEmpty(s))
                    {
                        titleCollection.Add(s);
                    }
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DemoDataProvider"/> class.
        /// </summary>
        public DemoDataProvider()
        {
            this.sampleMediaBinUri = new Uri("http://rce.litwareinc.com/samples/2.0/MediaBin/11111111-1111-1111-1111-111111111111");

            this.libraryContainer = new Container();

            // Adding sample videos;
            //this.libraryContainer.Items.Add(CreateSmoothVideoItem(CreateUri(VideoItems), "Elephants Dream", 653.791678, SmpteFrameRate.Smpte2997NonDrop, "http://video3.smoothhd.com/ondemand/ElephantsDream.ism/Manifest", 1280, 720, "SmoothStream"));
            this.libraryContainer.Items.Add(CreateSmoothVideoItem(CreateUri(VideoItems), "Amazing Caves", 85.4999, SmpteFrameRate.Unknown, "http://www.indoorworx.com/SmoothStreaming/Amazing_Caves_1080.ism/Manifest", 852, 480, "SmoothStream"));

            this.libraryContainer.Items.Add(CreateImageItem("Francis & ESQL", "http://i.msdn.microsoft.com/bb969103.how-we-do-it(en-us,MSDN.10).png", 300, 200));

            this.libraryContainer.Items.Add(CreateSmoothVideoItem(CreateUri(VideoItems), "NBA", 408, SmpteFrameRate.Smpte2997NonDrop, "http://video3.smoothhd.com/ondemand/NBA.ism/Manifest", 1280, 720, "SmoothStream"));
            this.libraryContainer.Items.Add(CreateImageItem("p&p Logo", "http://i.msdn.microsoft.com/ms998572.pandp-logo-txt-2009(en-us,MSDN.10).png", 250, 68));

            this.libraryContainer.Items.Add(CreateSmoothVideoItem(CreateUri(VideoItems), "Basic Curveball", 62.1621042, SmpteFrameRate.Smpte2997Drop, "http://video3.smoothhd.com/ondemand/eHow_Baseball.ism/Manifest", 1280, 720, "SmoothStream"));
            this.libraryContainer.Items.Add(CreateAudioItem("Glenn Block on Prism", 2286, "http://herdingcode.com/wp-content/uploads/HerdingCode-0011-Glenn-Block-Part-1.mp3"));

            this.libraryContainer.Items.Add(CreateSmoothVideoItem(CreateUri(VideoItems), "Big Buck Bunny", 596.458333, SmpteFrameRate.Smpte2997NonDrop, "http://video3.smoothhd.com/ondemand/Big%20Buck%20Bunny%20Adaptive.ism/Manifest", 1280, 720, "SmoothStream"));

            this.libraryContainer.Items.Add(CreateVideoItem(CreateUri(VideoItems), "Carol Bartz", 155, SmpteFrameRate.Smpte2997NonDrop, "http://208.217.186.229/media/WMV/CarolBartz.wmv", 320, 240, "Master"));
            this.libraryContainer.Items.Add(CreateVideoItem(CreateUri(VideoItems), "Steve Ballmer", 153, SmpteFrameRate.Smpte2997NonDrop, "http://208.217.186.229/media/WMV/SteveBallmer.wmv", 320, 240, "Master"));

            this.libraryContainer.Items.Add(CreateImageItem("XBox Live", "http://www.xbox.com/NR/rdonlyres/09842316-4F8D-46E5-A504-BE7AB207CE69/0/xbox_white_1280x1204.jpg", 1280, 1024));
            this.libraryContainer.Items.Add(CreateImageItem("PDC 2009 640x474", "http://blogs.southworks.net/srenzi/files/2009/11/image3.png", 640, 474));
            this.libraryContainer.Items.Add(CreateImageItem("Windows 63 x 63", "http://i.microsoft.com/global/En/us/PublishingImages/SLWindowPane/Windows_T.png", 63, 63));

            // Adding sample comments
            this.sampleComments = new CommentCollection();
            this.sampleComments.Add(CreateComment("David", "Some comment", "Global", DateTime.Today, null, null, DateTime.Today.AddDays(-15)));
            this.sampleComments.Add(CreateComment("Jay", "This is the best one!!", "Timeline", new DateTime(2008, 2, 10), 1400, 1520, DateTime.Today.AddDays(-15)));
            this.sampleComments.Add(CreateComment("David", "This is a Shot comment", "Shot", new DateTime(2008, 2, 10), 980, 1060, DateTime.Today.AddDays(-15)));

            // Adding sample media bin
            this.sampleMediaBin = new MediaBin {
                Id = this.sampleMediaBinUri
            };
            this.sampleMediaBin.Items.Add(this.libraryContainer.Items[0]);
            this.sampleMediaBin.Items.Add(this.libraryContainer.Items[1]);
            this.sampleMediaBin.Items.Add(this.libraryContainer.Items[2]);

            // Adding sample tracks
            this.sampleTracks = new TrackCollection();
            this.sampleTracks.Add(CreateTrack(TrackType.Visual));

            this.sampleTracks[0].Shots.Add(CreateShot(this.sampleMediaBin.Items[0], 180, ((VideoItem)this.sampleMediaBin.Items[0]).Duration.Value - 180, 800, 100));
            this.sampleTracks[0].Shots.Add(CreateShot(this.sampleMediaBin.Items[0], 0, ((VideoItem)this.sampleMediaBin.Items[0]).Duration.Value - 60, 0, 65));
            this.sampleTracks[0].Shots[0].Comments.Add(this.sampleComments[2]);

            this.sampleTracks.Add(CreateTrack(TrackType.Audio));

            // this.sampleTracks[1].Shots.Add(CreateShot(this.sampleMediaBin.Items[1], 0, ((AudioItem)this.sampleMediaBin.Items[1]).Duration.Value, 60, 80));

            // Adding sample title templates
            this.sampleTitleTemplates = new TitleTemplateCollection();
            this.sampleTitleTemplates.Add(CreateTitleTemplate("FadeCenter"));
            this.sampleTitleTemplates.Add(CreateTitleTemplate("Spinner"));
            this.sampleTitleTemplates.Add(CreateTitleTemplate("ScrollingCenter"));
            this.sampleTitleTemplates.Add(CreateTitleTemplate("ZoomCenter"));

            // Adding sample titles
            this.sampleTitles = new TitleCollection();
            this.sampleTitles.Add(CreateTitle(this.sampleTitleTemplates[0], 1200, 600));
            this.sampleTitles.Add(CreateTitle(this.sampleTitleTemplates[0], 2200, 400));

            // Adding sample project
            this.sampleProject = new Project
            {
                Id               = new Uri("http://rce.litwareinc.com/samples/2.0/Projects/11111111-1111-1111-1111-111111111111"),
                Title            = "Sample Project",
                Creator          = @"RCE\ejadib",
                Created          = new DateTime(2009, 1, 1),
                RippleMode       = false,
                AutoSaveInterval = 10,
                SmpteFrameRate   = SmpteFrameRate.Smpte2997NonDrop.ToString(),
                StartTimeCode    = 1802,
                MediaBin         = this.sampleMediaBin,
                Comments         = { this.sampleComments[0], this.sampleComments[1], this.sampleComments[2] },
                Timeline         = { this.sampleTracks[0], this.sampleTracks[1] },
                Titles           = { this.sampleTitles[0], this.sampleTitles[1] }
            };

            this.sampleProjects = new ProjectCollection();
            this.sampleProjects.Add(this.sampleProject);

            this.sampleProjects.Add(new Project
            {
                Id               = new Uri("http://rce.litwareinc.com/samples/2.0/Projects/CC8191B0-64FF-438b-89D1-C9464B310FB7"),
                Title            = "WithStartTimeCode1802",
                Creator          = @"RCE\ejadib",
                Created          = new DateTime(2009, 3, 1),
                RippleMode       = false,
                AutoSaveInterval = 10,
                SmpteFrameRate   = SmpteFrameRate.Smpte25.ToString(),
                StartTimeCode    = 1802,
                MediaBin         = this.sampleMediaBin,
                Comments         = { this.sampleComments[0], this.sampleComments[1], this.sampleComments[2] },
                Timeline         = { this.sampleTracks[0], this.sampleTracks[1] },
                Duration         = 200
            });

            this.sampleProjects.Add(new Project
            {
                Id               = new Uri("http://rce.litwareinc.com/samples/2.0/Projects/0F20DC18-2164-4683-AB65-51715A5DD7D3"),
                Title            = "WithStartTimeCode600",
                Creator          = @"RCE\ejadib",
                Created          = new DateTime(2009, 2, 6),
                RippleMode       = false,
                AutoSaveInterval = 10,
                SmpteFrameRate   = SmpteFrameRate.Smpte2997Drop.ToString(),
                StartTimeCode    = 600,
                MediaBin         = this.sampleMediaBin,
                Comments         = { this.sampleComments[0], this.sampleComments[1], this.sampleComments[2] },
                Timeline         = { this.sampleTracks[0], this.sampleTracks[1] },
                Duration         = 400
            });

            this.sampleProjects.Add(new Project
            {
                Id               = new Uri("http://rce.litwareinc.com/samples/2.0/Projects/0B05A8F0-1D3C-44bb-AD71-1387D2A93414"),
                Title            = "No Titles",
                Creator          = @"RCE\ejadib",
                Created          = new DateTime(2009, 3, 25),
                RippleMode       = true,
                AutoSaveInterval = 10,
                SmpteFrameRate   = SmpteFrameRate.Smpte2997NonDrop.ToString(),
                StartTimeCode    = 0,
                MediaBin         = this.sampleMediaBin,
                Comments         = { this.sampleComments[0], this.sampleComments[1], this.sampleComments[2] },
                Timeline         = { this.sampleTracks[0], this.sampleTracks[1] },
                Duration         = 600
            });
        }
예제 #8
0
 private bool _LoadTitlesFromMyMoviesDB(TitleCollection titleCollection)
 {
     return false;
 }
예제 #9
0
 public bool LoadTitlesFromMyMoviesDB(TitleCollection titleCollection)
 {
     return false;
 }
예제 #10
0
        /// <summary>
        /// Initializes the various properties of the class
        /// </summary>
        private void Init()
        {
            // Initialize colorSets
            //ColorSets = new ColorSets();

            // Initialize tooltip
            ToolTips = new ToolTipCollection();

            // Initialize title list
            Titles = new TitleCollection();

            // Initialize legend list
            Legends = new LegendCollection();

            // Initialize trendLine list
            TrendLines = new TrendLineCollection();

            // Initialize AxesX list
            AxesX = new AxisCollection();

            // Initialize AxesY list
            AxesY = new AxisCollection();

            // Initialize Series list
            Series = new DataSeriesCollection();

            // Initialize PlotArea
            PlotArea = new PlotArea() { Chart = this };

            // Attach event handler on collection changed event with ToolTip collection
            ToolTips.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(ToolTips_CollectionChanged);

            // Attach event handler on collection changed event with Title collection
            Titles.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Titles_CollectionChanged);

            // Attach event handler on collection changed event with Legend collection
            Legends.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Legends_CollectionChanged);

            // Attach event handler on collection changed event with TrendLines collection
            TrendLines.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(TrendLines_CollectionChanged);

            // Attach event handler on collection changed event with DataSeries collection
            Series.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Series_CollectionChanged);

            // Attach event handler on collection changed event with axisX collection
            (AxesX as AxisCollection).CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(AxesX_CollectionChanged);

            // Attach event handler on collection changed event with AxisY collection
            (AxesY as AxisCollection).CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(AxesY_CollectionChanged);
        }
예제 #11
0
        public static void UpdateShopifyProduct(UpdateShopifyProductModel item)
        {
            using (var db = AliShopEntities.New())
            {
                var shopifyProductRules = RulesCreator.NewRules <AliShopifyProductRules>(db);
                var shopifyPriceRules   = RulesCreator.NewRules <AliShopifyPriceRules>(db);
                var parameterRules      = RulesCreator.NewRules <AliParameterRules>(db);

                var shopifyProduct = shopifyProductRules.GetById(
                    item.AliShopifyProductId,
                    "AliProduct.AliProductVariant",
                    "AliProduct.AliProductImage",
                    "AliProduct.AliProductLink",
                    "AliProduct.AliProductOption",
                    "AliProduct.AliProductSpecific",
                    "AliProduct.AliStore"
                    ).First();

                foreach (var image in shopifyProduct.AliProduct.AliProductImage)
                {
                    if (!image.Url.EndsWith("_640x640.jpg"))
                    {
                        image.Url += "_640x640.jpg";
                    }
                }

                var title           = shopifyProduct.AliProduct.Title;
                var invalidKeywords = ShopifyHelper.GetShopifyTags(parameterRules.GetByName("product_title_invalid_keywords").Value);

                foreach (var keyword in invalidKeywords)
                {
                    title = Regex.Replace(title, Regex.Escape(keyword), "", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase).Trim();
                }

                title = Regex.Replace(title, "\\s{1,}", " ", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
                title = new TitleCollection(title).Short(100).Edited;

                Print.PrintStatus(item.RefName, "BeforeRun", title);

                var calculationPrices     = shopifyPriceRules.GetFixedCalculationPrices(shopifyProduct.AliProductId);
                var stockSafetyMargin     = int.Parse(parameterRules.GetByName("stock_safety_margin").Value);
                var handleFriendlyName    = ShopifyHelper.ShopifyHandleFriendlyName(shopifyProduct.AliProductId, title);
                var shopifyProductService = new ShopifyProductService(AppSettings.ShopifyMyShopifyUrl, AppSettings.ShopifyApiKey);
                var shopifyOrderService   = new ShopifyOrderService(AppSettings.ShopifyMyShopifyUrl, AppSettings.ShopifyApiKey);
                var getShopifyProduct     = default(ShopifyProduct);

                var tryStatusOK = Program.Try(item.RefName, title, 3, () => getShopifyProduct = ShopifyMethod.GetProductOnShopify(shopifyProductService, shopifyProduct.HandleFriendlyName ?? handleFriendlyName));

                Print.PrintStatus(item.RefName, tryStatusOK ? "GetProduct" : "FailGetProduct", title, ConsoleColor.Blue);

                if (tryStatusOK)
                {
                    var changeShopifyProduct = ShopifyHelper.ChangeShopifyProduct(shopifyProduct, calculationPrices, getShopifyProduct, stockSafetyMargin, handleFriendlyName, title);

                    tryStatusOK = Program.Try(item.RefName, title, 3, () => getShopifyProduct = ShopifyMethod.SaveProductOnShopify(shopifyProductService, changeShopifyProduct));

                    Print.PrintStatus(item.RefName, tryStatusOK ? "SaveProduct" : "FailSaveProduct", title, ConsoleColor.Blue);
                }

                if (getShopifyProduct != null && tryStatusOK)
                {
                    tryStatusOK = Program.Try(item.RefName, title, 3, () => getShopifyProduct = ShopifyMethod.UpdateVariantsOnShopify(shopifyProductService, shopifyProduct, getShopifyProduct));

                    Print.PrintStatus(item.RefName, tryStatusOK ? "UpdateVariant" : "FailUpdateVariant", title, ConsoleColor.Blue);
                }

                var hasProductOnShopify = getShopifyProduct != null;

                if (hasProductOnShopify && (!tryStatusOK || !shopifyProduct.AliProduct.Enabled && getShopifyProduct.PublishedAt != null))
                {
                    var unPublishTryStatusOK = Program.Try(item.RefName, title, 3, () => getShopifyProduct = ShopifyMethod.UnpublishProductOnShopify(shopifyProductService, getShopifyProduct.Id.Value));

                    Print.PrintStatus(item.RefName, unPublishTryStatusOK ? "Unpublish" : "FailUnpublish", title, ConsoleColor.Blue);
                }

                shopifyProduct = shopifyProductRules.GetById(item.AliShopifyProductId).Where(i => i.RowVersion == shopifyProduct.RowVersion).FirstOrDefault();

                if (hasProductOnShopify)
                {
                    if (shopifyProduct != null)
                    {
                        shopifyProduct.AvgCompareAtPrice       = (decimal?)getShopifyProduct.Variants.Average(i => i.CompareAtPrice);
                        shopifyProduct.AvgPrice                = (decimal?)getShopifyProduct.Variants.Average(i => i.Price);
                        shopifyProduct.ExistsOnShopify         = true;
                        shopifyProduct.HandleFriendlyName      = getShopifyProduct.Handle;
                        shopifyProduct.LastUpdate              = DateTime.UtcNow;
                        shopifyProduct.Published               = getShopifyProduct.PublishedAt != null;
                        shopifyProduct.RequiredUpdateOnShopify = !tryStatusOK;
                        shopifyProduct.ShopifyProductId        = getShopifyProduct.Id;

                        db.SaveChanges();
                    }
                }
                else
                {
                    if (shopifyProduct != null)
                    {
                        shopifyProduct.ExistsOnShopify         = false;
                        shopifyProduct.LastUpdate              = DateTime.UtcNow;
                        shopifyProduct.RequiredUpdateOnShopify = true;

                        db.SaveChanges();
                    }

                    Print.PrintStatus(item.RefName, "DoesNotHaveProductOnShopify", title, ConsoleColor.Blue);
                }

                Print.PrintStatus(item.RefName, shopifyProduct == null ? "NotUpdateOnDatabase" : "UpdateOnDatabase", title, ConsoleColor.Blue);
                Print.PrintStatus(item.RefName, "RunComplete", title, ConsoleColor.Green);
            }
        }
예제 #12
0
 private bool _LoadTitlesFromMyMoviesDB(TitleCollection titleCollection)
 {
     return(false);
 }
예제 #13
0
 public bool LoadTitlesFromMyMoviesDB(TitleCollection titleCollection)
 {
     return(false);
 }