public void ShowSimpleMessageDialog()
		{
			using (var dlg = new SimpleMessageDialog("my message", "my title"))
			{
				dlg.Show();
				System.Threading.Thread.Sleep(2000);
			}
		}
		public void ShowSimpleMessageDialog_CaptionBarCanBeHidden()
		{
			using (var dlg = new SimpleMessageDialog("the caption bar can be hidden if truly desired", ""))
			{
				dlg.Show();
				System.Threading.Thread.Sleep(2000);
			}
		}
		public void ShowSimpleMessageDialog_LongMessageWraps()
		{
			const string longMessage = "my very long message which likes to wrap and wrap and wrap and wrap and wrap and wrap and wrap";
			using (var dlg = new SimpleMessageDialog(longMessage, "my title"))
			{
				dlg.Show();
				System.Threading.Thread.Sleep(2000);
			}
		}
Ejemplo n.º 4
0
        /// <summary>
        /// First, we try to get the token quickly and quietly.
        /// If that fails, we put up a dialog and wait a number of seconds while we wait for the token to come free.
        /// </summary>
        /// <param name="uniqueIdentifier"></param>
        /// <param name="applicationName">Optional; used for user messaging</param>
        /// <param name="secondsToWait">Default = 10; Number of seconds the dialog will be displayed while waiting for the token to come free</param>
        /// <returns>True if we successfully acquired the token, false otherwise</returns>
        public static bool AcquireToken(string uniqueIdentifier, string applicationName = null, int secondsToWait = 10)
        {
            Guard.AgainstNull(uniqueIdentifier, "uniqueIdentifier");

            bool tokenAcquired = AcquireTokenQuietly(uniqueIdentifier);
            if (tokenAcquired)
                return true;

            string waitingMsg = applicationName == null ?
                L10NSharp.LocalizationManager.GetString("Application.WaitingFinish.General", "Waiting for other application to finish...") :
                String.Format(
                    L10NSharp.LocalizationManager.GetString("Application.WaitingFinish.Specific", "Waiting for other {0} to finish...", "{0} is the application name"),
                    applicationName);
            using (var dlg = new SimpleMessageDialog(waitingMsg, applicationName))
            {
                dlg.Show();
                try
                {
                    for (int i=0; i < secondsToWait; i++)
                {
                        tokenAcquired = AcquireTokenQuietly(uniqueIdentifier);
                        if (tokenAcquired)
                            break;
                        Thread.Sleep(1000);
                    }
                }
                catch (Exception e)
                {
                    string errorMsg = applicationName == null ?
                        L10NSharp.LocalizationManager.GetString("Application.ProblemStarting.General",
                        "There was a problem starting the application which might require that you restart your computer.") :
                        String.Format(
                            L10NSharp.LocalizationManager.GetString("Application.ProblemStarting.Specific",
                                "There was a problem starting {0} which might require that you restart your computer.", "{0} is the application name"),
                            applicationName);
                    ErrorReport.NotifyUserOfProblem(e, errorMsg);
                }
            }

            if (!tokenAcquired) // cannot acquire
            {
                string errorMsg = applicationName == null ?
                        L10NSharp.LocalizationManager.GetString("Application.AlreadyRunning.General",
                        "Another copy of the application is already running. If you cannot find it, restart your computer.") :
                        String.Format(
                            L10NSharp.LocalizationManager.GetString("Application.AlreadyRunning.Specific",
                                "Another copy of {0} is already running. If you cannot find that {0}, restart your computer.",
                                "{0} is the application name"),
                            applicationName);
                ErrorReport.NotifyUserOfProblem(errorMsg);
                return false;
            }
            return true;
        }
		public void ShowSimpleMessageDialog_CaptionNotProvided_StillHasCaptionBar()
		{
			using (var dlg = new SimpleMessageDialog("the caption bar is still there, though empty"))
			{
				dlg.Show();
				System.Threading.Thread.Sleep(2000);
			}
			using (var dlg = new SimpleMessageDialog("the caption bar is still there, though empty", null))
			{
				dlg.Show();
				System.Threading.Thread.Sleep(2000);
			}
		}
Ejemplo n.º 6
0
        public static bool Pollinate(Sim man, Sim woman)
        {
            if (woman.LotHome == null)
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " is homeless.");
                return(false);
            }
            else if (woman.Household.IsServiceNpcHousehold)
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " is an NPC and can not be pollinated.");
                return(false);
            }
            else if ((!AllowOverstuffed) && (woman.Household.NumMembersCountingPregnancy >= 8))
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " house has too many people.");
                return(false);
            }
            else if (woman.SimDescription.Pregnancy != null)
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " has already been pollinated.");
                return(false);
            }
            else if (woman.SimDescription.AgingState.IsAgingInProgress())
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " is too old to be pollinated.");
                return(false);
            }
            else if (woman.SimDescription.Elder)
            {
                SimpleMessageDialog.Show("Pollination", woman.Name + " is too old to be pollinated.");
                return(false);
            }

            Sims3.Gameplay.ActorSystems.AgingManager.Singleton.CancelAgingAlarmsForSim(woman);

            Sims3.Gameplay.ActorSystems.Pregnancy p = new Sims3.Gameplay.ActorSystems.Pregnancy(woman, man);

            p.PreggersAlarm = woman.AddAlarmRepeating(1f, TimeUnit.Hours, new AlarmTimerCallback(p.HourlyCallback), 1f, TimeUnit.Hours, "Hourly Pregnancy Update Alarm", AlarmType.AlwaysPersisted);

            woman.SimDescription.Pregnancy = p;

            EventTracker.SendEvent(new Sims3.Gameplay.ActorSystems.PregnancyEvent(EventTypeId.kGotPregnant, woman, man, p, null));

            SimpleMessageDialog.Show("Pollination", woman.Name + " has been successfully pollinated.");
            return(true);
        }
Ejemplo n.º 7
0
        protected static bool BumpDown(SimDescription a, SimDescription b, bool prompt)
        {
            Relationship relation = Relationship.Get(a, b, true);

            if (relation == null)
            {
                return(false);
            }

            string currentState = relation.LTR.CurrentLTR;

            string nextState = ChangeRelationship.NextNegativeRomanceState(currentState);

            if (nextState == null)
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Lower Level", "There is no way to go lower than these sims already are.");
                }
                return(false);
            }

            if (relation.LTR.RelationshipIsInappropriate(LTRData.Get(nextState)))
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show("Bump to Lower Level", "A relationship of " + nextState + " is unavailable to the selected sims.");
                }
                return(false);
            }

            if (a.Partner == b)
            {
                a.Partner = null;
                b.Partner = null;
            }

            relation.LTR.ForceChangeState(nextState);
            if (currentState == relation.LTR.CurrentLTR)
            {
                return(false);
            }

            StyledNotification.Show(new StyledNotification.Format("Relationship between " + a.FirstName + " " + a.LastName + " and " + b.FirstName + " " + b.LastName + " changed to " + nextState, StyledNotification.NotificationStyle.kAlert));
            return(true);
        }
Ejemplo n.º 8
0
        protected SimDescription GetSelection()
        {
            if (Sim.ActiveActor == null)
            {
                return(null);
            }

            SimSelection sims = SimSelection.Create(this);

            if (sims.IsEmpty)
            {
                SimpleMessageDialog.Show(Name, StoryProgression.Localize("SimID:Error"));
                return(null);
            }

            return(sims.SelectSingle());
        }
Ejemplo n.º 9
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            CommonSelection <Item> .Results selection = new CommonSelection <Item>(Name, this.GetOptions()).SelectMultiple();

            foreach (Item item in selection)
            {
                mPicks.Add(item.Value);
            }

            if (mPicks.Count == 0)
            {
                SimpleMessageDialog.Show(Name, Common.Localize("Selection:Error"));
                return(OptionResult.Failure);
            }

            return(OptionResult.SuccessRetain);
        }
Ejemplo n.º 10
0
        protected override OptionResult Run(GameHitParameters <Sim> parameters)
        {
            SimOutfit outfit = new SimOutfit(CASUtils.GetOutfitInGameObject(parameters.mTarget.Proxy.ObjectId));

            string msg = "";

            foreach (CASPart part in outfit.Parts)
            {
                msg += CASParts.PartToString(part);
            }

            Common.WriteLog(msg);

            SimpleMessageDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Success", parameters.mTarget.IsFemale, new object[] { parameters.mTarget }));

            return(OptionResult.SuccessClose);
        }
Ejemplo n.º 11
0
        public OptionResult Perform()
        {
            RecipeSelection.Results results = this.SelectMultiple();

            if (results.Count == 0)
            {
                SimpleMessageDialog.Show(Common.Localize("Selection:Error"), Common.Localize("Selection:NoChoices"));
                return(OptionResult.Failure);
            }

            foreach (Item item in results)
            {
                this.selectedItems.Add(item.Value);
            }

            return(OptionResult.SuccessClose);
        }
Ejemplo n.º 12
0
        protected override bool Initialize()
        {
            string text = StringInputDialog.Show(Common.Localize(LocalizeKey + ":MenuName"), Common.Localize(LocalizeKey + ":Prompt"), "0", 1, StringInputDialog.Validation.Number);

            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }

            if (!int.TryParse(text, out mRadius))
            {
                SimpleMessageDialog.Show(Common.Localize(LocalizeKey + ":MenuName"), Common.Localize("Numeric:Error", false, new object[] { text }));
                return(false);
            }

            return(true);
        }
Ejemplo n.º 13
0
        protected override OptionResult Run(Lot lot, Household me)
        {
            int maxSelection = GetSpace(me);

            if (maxSelection <= 0)
            {
                SimpleMessageDialog.Show(Name, Common.Localize("AddSimHouse:TooMany"));
                return(OptionResult.Failure);
            }

            SimDescription targetSim = mActor.SimDescription;

            if (mTarget is Sim)
            {
                targetSim = (mTarget as Sim).SimDescription;
            }
            else if ((me != null) && (CommonSpace.Helpers.Households.NumSims(me) > 0))
            {
                if (Sim.ActiveActor != null)
                {
                    targetSim = Sim.ActiveActor.SimDescription;
                }
                else
                {
                    targetSim = me.AllSimDescriptions[0];
                }
            }

            bool okayed = false;
            List <IMiniSimDescription> sims = new Sims.MoveIn(me).GetSelection(targetSim, Name, SelectionOption.List, maxSelection, CanApplyAll(), out okayed);

            if ((sims == null) || (sims.Count == 0))
            {
                if (okayed)
                {
                    return(OptionResult.SuccessClose);
                }
                else
                {
                    return(OptionResult.Failure);
                }
            }

            return(PrivatePerform(lot, me, sims));
        }
Ejemplo n.º 14
0
        protected static bool ImportSettings(XmlElement element)
        {
            if (element == null)
            {
                return(false);
            }

            if (Persistence.ImportSettings(element))
            {
                SimpleMessageDialog.Show(Common.Localize("ImportSettings:MenuName"), Common.Localize("ImportSettings:Success"));
                return(true);
            }
            else
            {
                SimpleMessageDialog.Show(Common.Localize("ImportSettings:MenuName"), Common.Localize("ImportSettings:Error"));
                return(false);
            }
        }
Ejemplo n.º 15
0
        public override bool Run()
        {
            try
            {
                Sim target = Target as Sim;

                SimOutfit outfit = target.SimDescription.GetOutfit(target.CurrentOutfitCategory, target.CurrentOutfitIndex);

                DebugEnabler.WriteLog(outfit.Key.ToString());

                SimpleMessageDialog.Show(Common.Localize("ShowOutfitKey:MenuName"), outfit.Key.ToString());
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
            }
            return(true);
        }
Ejemplo n.º 16
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            if (AcceptCancelDialog.Show(Common.Localize("InheritVoices:Prompt")))
            {
                Dictionary <SimDescription, bool> completed = new Dictionary <SimDescription, bool>();

                int count = 0;

                List <Sim> list = new List <Sim>(Sims3.Gameplay.Queries.GetObjects <Sim>());
                foreach (Sim sim in list)
                {
                    count += Inherit(sim.SimDescription, completed);
                }

                SimpleMessageDialog.Show(Name, Common.Localize("InheritVoices:Result", false, new object[] { count }));
            }
            return(OptionResult.SuccessClose);
        }
Ejemplo n.º 17
0
        /// <summary>
        ///     Delete user func
        /// </summary>
        /// <param name="o"></param>
        private async void ExecuteRunDeleteMemberDialog(object o)
        {
            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new SimpleMessageDialog
            {
                Message =
                {
                    Text          = string.Format("你确定要删除\r\n 用户名:{0}  账户:{1} ?", ((UserInfo)o).Name, ((UserInfo)o).UserName),
                    TextAlignment = TextAlignment.Center
                }
            };

            //show the dialog
            var result = await DialogHost.Show(view, "RootDialog", DeleteMemberDialogClosingEventHandler);

            //check the result...
            Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));
        }
Ejemplo n.º 18
0
        /// <summary>
        ///     Restore database
        /// </summary>
        /// <param name="o"></param>
        private async void ExecuteRunDatabaseReview(object o)
        {
            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new SimpleMessageDialog
            {
                Message =
                {
                    Text          = "数据库恢复?\r\n" + ((DatabaseInfo)o).Name,
                    TextAlignment = TextAlignment.Center
                }
            };

            //show the dialog
            var result = await DialogHost.Show(view, "RootDialog");

            //check the result...
            Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));
        }
Ejemplo n.º 19
0
        protected override int Convert(string value, bool prompt, out bool error)
        {
            int result = 0;

            if (!int.TryParse(value, out result))
            {
                if (prompt)
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                }

                error = true;
                return(0);
            }

            error = false;
            return(result);
        }
Ejemplo n.º 20
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            try
            {
                Sim sim = parameters.mTarget as Sim;

                sim.InteractionQueue.QueueChanged += new QueueMonitor(sim).OnChanged;

                //sim.RoutingComponent.OnRoutingEvent += new RoutingMonitor(sim).OnPerform;

                SimpleMessageDialog.Show(Name, sim.FullName + " is now being monitored.");
            }
            catch (Exception e)
            {
                GameHitParameters <GameObject> .Exception(parameters, e);
            }
            return(OptionResult.SuccessClose);
        }
Ejemplo n.º 21
0
        /// <summary>
        ///     Export operation history table
        /// </summary>
        /// <param name="o"></param>
        private async void ExecuteRunExportOperationTable(object o)
        {
            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new SimpleMessageDialog
            {
                Message =
                {
                    Text          = "导出数据表?\r\n共 " + ((DataGrid)o).Items.Count + " 行",
                    TextAlignment = TextAlignment.Center
                }
            };

            //show the dialog
            var result = await DialogHost.Show(view, "RootDialog");

            //check the result...
            Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));
        }
Ejemplo n.º 22
0
        public static bool EnrollInAcademicCareer(Sim actor, IEnumerable <SimDescription> choices, out List <SimDescription> others, out int tuitionCost)
        {
            others      = null;
            tuitionCost = 0;
            if (!IntroTutorial.IsRunning || IntroTutorial.AreYouExitingTutorial())
            {
                if ((actor.DegreeManager != null) && actor.DegreeManager.ShouldDisplaySUATMessage(actor.SimDescription))
                {
                    SimpleMessageDialog.Show(Localization.LocalizeString("Gameplay/Objects/Electronics/Phone:HaveYouTakenSUAT", new object[0]), Localization.LocalizeString("Gameplay/Objects/Electronics/Phone:SUATBenefits", new object[0]), ModalDialog.PauseMode.PauseSimulator);
                }

                if (!UIUtils.IsOkayToStartModalDialog())
                {
                    return(false);
                }

                int termLen   = 0;
                int totalCost = 0;
                List <IEnrollmentData> list = EnrollmentDialogEx.Show(actor.SimDescription, choices, false, out termLen, out totalCost);
                if ((list != null) && (list.Count > 0))
                {
                    TravelUtil.PlayerMadeTravelRequest = true;
                    foreach (IEnrollmentData data in list)
                    {
                        SimDescription enrollingSimDesc = data.EnrollingSimDesc as SimDescription;
                        if (((enrollingSimDesc != null) && (enrollingSimDesc.CareerManager != null)) && (enrollingSimDesc.CareerManager.DegreeManager != null))
                        {
                            if (others == null)
                            {
                                others = new List <SimDescription>();
                            }
                            others.Add(enrollingSimDesc);
                            enrollingSimDesc.CareerManager.DegreeManager.SetEnrollmentData(data);
                            EventTracker.SendEvent(new AcademicEvent(EventTypeId.kEnrolledInUniversity, enrollingSimDesc.CreatedSim, (AcademicDegreeNames)data.AcademicDegreeName));
                        }
                    }
                    tuitionCost = -totalCost;

                    AcademicCareer.GlobalTermLength = (AcademicCareer.TermLength)termLen;
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 23
0
        /// <summary>
        ///     Search operation history
        /// </summary>
        /// <param name="o"></param>
        private async void ExecuteRunSearch(object o)
        {
            if (startTimeTime != null && endTimeTime != null && startTimeDate != null && endTimeDate != null)
            {
                if (startTimeDate <= endTimeDate)
                {
                    if (!(startTimeDate == endTimeDate && startTimeTime > endTimeTime))
                    {
                        ///do some thing
                        var view = new WitingDialog();

                        //show the dialog
                        var result = await DialogHost.Show(view, "RootDialog", Search_DialogHost_OnDialogOpening,
                                                           Search_DialogHost_OnDialogClosing);

                        //check the result...
                        Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " +
                                          (result ?? "NULL"));
                        return;
                    }
                }
            }

            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view1 = new SimpleMessageDialog
            {
                Message =
                {
                    Text          = "开始时间不能晚于结束时间!",
                    TextAlignment = TextAlignment.Center
                },
                CancelButton =
                {
                    Visibility = Visibility.Collapsed
                }
            };

            //show the dialog
            var result1 = await DialogHost.Show(view1, "RootDialog");


            //check the result...
            Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result1 ?? "NULL"));
        }
Ejemplo n.º 24
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            List <SimDescription> sims = new List <SimDescription>();

            bool okayed;
            List <IMiniSimDescription> miniSims = FilteredSelection.Selection(me, Common.Localize("FamilyTreeInteraction:Parent"), new ParentTest(me).OnTest, SelectionOption.List, 7, false, out okayed);

            if (miniSims != null)
            {
                foreach (IMiniSimDescription miniSim in miniSims)
                {
                    SimDescription sim = miniSim as SimDescription;
                    if (sim == null)
                    {
                        continue;
                    }

                    sims.Add(sim);
                }
            }

            if (sims.Count == 0)
            {
                sims.AddRange(Relationships.GetParents(me));
            }

            if (sims.Count < 2)
            {
                SimpleMessageDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Failure"));
                return(false);
            }

            CASGeneticsEx.InitHousehold(sims);

            CASGeneticsEx.sChoice = me;

            if (CASGenetics.gSingleton == null)
            {
                CASGenetics.Load();
            }

            return(true);
        }
Ejemplo n.º 25
0
            protected override bool PrivatePerform()
            {
                if (Value)
                {
                    SimpleMessageDialog.Show(Name, Localize("Warning"));
                }
                else if (!AcceptCancelDialog.Show(Localize("Prompt")))
                {
                    return(false);
                }

                if (!base.PrivatePerform())
                {
                    return(false);
                }

                new MarkAsProtectedScenario().Post(Manager, true, false);
                return(true);
            }
        public override Phone.Call.ConversationBehavior OnCallConnected()
        {
            try
            {
                if ((Actor.LotHome == null) || !Actor.IsSelectable)
                {
                    return(Phone.Call.ConversationBehavior.JustHangUp);
                }

                float arrivalTime = Phone.kForeignVisitorArrivalTime;

                DateAndTime startTime = SimClock.CurrentTime();

                if (!Common.kDebugging)
                {
                    float hoursPassedOfDay = SimClock.HoursPassedOfDay;
                    float num2             = 24f - (hoursPassedOfDay - arrivalTime);
                    if (num2 < 1f)
                    {
                        num2 += 24f;
                    }

                    long ticks = SimClock.ConvertToTicks(num2, TimeUnit.Hours);
                    startTime += new DateAndTime(ticks);
                }

                SimpleMessageDialog.Show(Common.LocalizeEAString("Gameplay/Situations/Party:InviteForeignVisitorsTitle"), Common.LocalizeEAString(false, "Gameplay/Situations/Party:InviteForeignVisitorsStart", new object[] { arrivalTime }), ModalDialog.PauseMode.PauseSimulator);

                new ForeignVisitorsSituationEx(Actor.LotHome, Actor, new List <MiniSimDescription>(mSimsToCall), startTime);

                return(Phone.Call.ConversationBehavior.ExpressSatisfaction);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(ConversationBehavior.JustHangUp);
        }
Ejemplo n.º 27
0
        protected override OptionResult Run(GameHitParameters <Sim> parameters)
        {
            List <Item> allOptions = new List <Item>();

            foreach (OutfitCategories category in GetCategories(parameters.mTarget.SimDescription))
            {
                int count = GetOutfitCount(parameters.mTarget.SimDescription, category);
                for (int i = 0; i < count; i++)
                {
                    CASParts.Key outfitKey  = new CASParts.Key(category, i);
                    CASParts.Key displayKey = new CASParts.Key(category, i);
                    bool         alternate  = false;
                    if (!Allow(parameters.mTarget.SimDescription, ref outfitKey, ref alternate, ref displayKey))
                    {
                        continue;
                    }

                    allOptions.Add(new Item(outfitKey, alternate, parameters.mTarget.SimDescription, displayKey));
                }
            }

            if (allOptions.Count == 0)
            {
                SimpleMessageDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":NoChoices", parameters.mTarget.IsFemale, new object[] { parameters.mTarget }));
                return(OptionResult.Failure);
            }

            CommonSelection <Item> .Results choices = new CommonSelection <Item>(Name, parameters.mTarget.FullName, allOptions).SelectMultiple();
            if ((choices == null) || (choices.Count == 0))
            {
                return(OptionResult.Failure);
            }

            List <Item> selection = new List <Item>(choices);

            // Remove them in reverse to ensure that removing earlier indices doesn't alter the index of later ones
            for (int i = selection.Count - 1; i >= 0; i--)
            {
                Perform(parameters.mTarget.SimDescription, selection[i].Value, selection[i].mDisplayKey);
            }

            return(OptionResult.SuccessClose);
        }
Ejemplo n.º 28
0
        protected override bool Run()
        {
            base.StandardEntry();
            GameObject objectToFlood = base.GetSelectedObject() as GameObject;

            if (ChaosModPainting.FloodedObjects.Contains(objectToFlood))
            {
                SimpleMessageDialog.Show("Error", "Object is already flooded");
            }
            else
            {
                PuddleManager.FlowingPuddleTuning noah = new PuddleManager.FlowingPuddleTuning();
                noah.MaxNumPuddles = 100;
                PuddleManager.AddFlowingPuddle(objectToFlood, noah);
                ChaosModPainting.FloodedObjects.Add(objectToFlood);
            }
            base.StandardExit();
            return(true);
        }
Ejemplo n.º 29
0
 public static int cleanVampFaces(object obj)
 {
     try
     {
         foreach (KeyValuePair <Sim, bool> pair in thirstySims)
         {
             if (thirstySims[pair.Key])
             {
                 Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTThirst.runClean), pair.Key));
             }
         }
     }
     catch (Exception exception)
     {
         SimpleMessageDialog.Show("Vampire Tweaker - Uninstalling Wizard", "An error is ocurred when uninstalling. Check notification bar");
         StyledNotification.Show(new StyledNotification.Format("Failed the removal of the sim dictionary (thirstySims) \n" + exception, StyledNotification.NotificationStyle.kDebugAlert));
     }
     return(1);
 }
Ejemplo n.º 30
0
        public static void runClean(object obj)
        {
            Sim sim = obj as Sim;

            if (sim != null)
            {
                try
                {
                    SimpleMessageDialog.Show("Vampire Tweaker - Uninstalling Wizard", "Cleaning red eyes of: " + sim.FullName + "...");
                    RemoveMakeup(sim);
                    SimpleMessageDialog.Show("Vampire Tweaker - Uninstalling Wizard", "Cleaned red eyes of: " + sim.FullName + "!");
                }
                catch (Exception exception)
                {
                    SimpleMessageDialog.Show("Vampire Tweaker - Uninstalling Wizard", "Failed the removal process of the thirst makeup of: " + sim.FullName + "!" + "\nCheck Notification bar");
                    StyledNotification.Show(new StyledNotification.Format("Failed the uninstall process in the removal of the thirst makeup of: " + sim.FullName + "!\nTechinical info to get more information about the error: \n" + exception, StyledNotification.NotificationStyle.kDebugAlert));
                }
            }
        }
Ejemplo n.º 31
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            OptionResult result = base.Run(parameters);

            if (result != OptionResult.Failure)
            {
                if (Value > Relativity.sOneMinute * 2)
                {
                    Value = Relativity.sOneMinute * 2;
                }

                if (Value > Relativity.sOneMinute)
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("FastSpeed:Prompt"));
                }
            }

            return(result);
        }
Ejemplo n.º 32
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            if (parameters.mTarget != null)
            {
                DoorPortalComponentEx.DoorSettings settings = GoHere.Settings.GetDoorSettings(parameters.mTarget.ObjectId);

                string open = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":PromptOpen"), settings.mDoorOpen.ToString());
                if (string.IsNullOrEmpty(open))
                {
                    return(OptionResult.Failure);
                }

                string close = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":PromptClose"), settings.mDoorClose.ToString());
                if (string.IsNullOrEmpty(close))
                {
                    return(OptionResult.Failure);
                }

                int openTime  = -1;
                int closeTime = -1;
                if (!int.TryParse(open, out openTime) || !int.TryParse(close, out closeTime))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(OptionResult.Failure);
                }

                if ((openTime < 1 || openTime > 23) || (closeTime < 1 || closeTime > 23))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:InvalidInput"));
                    return(OptionResult.Failure);
                }

                settings.mDoorOpen  = openTime;
                settings.mDoorClose = closeTime;
                GoHere.Settings.AddOrUpdateDoorSettings(parameters.mTarget.ObjectId, settings, false);

                Common.Notify(Common.Localize("Generic:Success"));

                return(OptionResult.SuccessClose);
            }

            return(OptionResult.Failure);
        }
Ejemplo n.º 33
0
        protected override OptionResult Run(Lot lot, Household me)
        {
            if (lot != null)
            {
                List <Item> allOptions = new List <Item>();

                foreach (Household house in Household.sHouseholdList)
                {
                    if (house.RealEstateManager == null)
                    {
                        continue;
                    }

                    PropertyData data = house.RealEstateManager.FindProperty(lot);
                    if (data == null)
                    {
                        continue;
                    }

                    allOptions.Add(new Item(house, lot, RealEstate.OwnerType.Full, data.TotalValue));
                }

                if (allOptions.Count == 0)
                {
                    SimpleMessageDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Failure"));
                    return(OptionResult.Failure);
                }

                CommonSelection <Item> .Results choices = new CommonSelection <Item>(Name, allOptions).SelectMultiple();
                if ((choices == null) || (choices.Count == 0))
                {
                    return(OptionResult.Failure);
                }

                foreach (Item item in choices)
                {
                    item.Perform();
                }
            }

            return(OptionResult.SuccessClose);
        }
Ejemplo n.º 34
0
        protected override List <Item> PrivateRun(SimDescription me, IEnumerable <Item> choices)
        {
            List <Item> selection = new List <Item>();

            foreach (Item choice in choices)
            {
                if (choice == null)
                {
                    continue;
                }

                int currentLevel = me.SkillManager.GetSkillLevel(choice.Skill);

                string text = StringInputDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Prompt", me.IsFemale, new object[] { choice.Name, choice.MaximumLevel }), currentLevel.ToString(), 256, StringInputDialog.Validation.None);
                if (string.IsNullOrEmpty(text))
                {
                    return(null);
                }

                float level;
                if (!float.TryParse(text, out level))
                {
                    SimpleMessageDialog.Show(Name, Common.Localize("Numeric:Error"));
                    return(null);
                }

                choice.Level = level;

                if (choice.Level < 0)
                {
                    choice.Level = -1;
                }
                else if (choice.Level > choice.MaximumLevel)
                {
                    choice.Level = choice.MaximumLevel;
                }

                selection.Add(choice);
            }

            return(selection);
        }
Ejemplo n.º 35
0
 public void MakeBloomPack(string path)
 {
     try
     {
         if (File.Exists(path))
         {
             //UI already go permission for this
             File.Delete(path);
         }
         Logger.WriteEvent("Making BloomPack");
         using (var pleaseWait = new SimpleMessageDialog("Creating BloomPack..."))
         {
             try
             {
                 pleaseWait.Show();
                 pleaseWait.BringToFront();
                 Application.DoEvents();                        //actually show it
                 Cursor.Current = Cursors.WaitCursor;
                 using (var zip = new ZipFile(Encoding.UTF8))
                 {
                     string dir = TheOneEditableCollection.PathToDirectory;
                     //nb: without this second argument, we don't get the outer directory included, and we need that for the name of the collection
                     zip.AddDirectory(dir, System.IO.Path.GetFileName(dir));
                     zip.Save(path);
                 }
                 //show it
                 Logger.WriteEvent("Showing BloomPack on disk");
                 Process.Start(Path.GetDirectoryName(path));
                 Analytics.Track("Create BloomPack");
             }
             finally
             {
                 Cursor.Current = Cursors.Default;
                 pleaseWait.Close();
             }
         }
     }
     catch (Exception e)
     {
         Palaso.Reporting.ErrorReport.NotifyUserOfProblem(e, "Could not make the BloomPack");
     }
 }
Ejemplo n.º 36
0
 public void MakeBloomPack(string path)
 {
     try
     {
         if(File.Exists(path))
         {
             //UI already go permission for this
             File.Delete(path);
         }
         Logger.WriteEvent("Making BloomPack");
         using (var pleaseWait = new SimpleMessageDialog("Creating BloomPack..."))
         {
             try
             {
                 pleaseWait.Show();
                 pleaseWait.BringToFront();
                 Application.DoEvents();//actually show it
                 Cursor.Current = Cursors.WaitCursor;
                 using (var zip = new ZipFile(Encoding.UTF8))
                 {
                     string dir = TheOneEditableCollection.PathToDirectory;
                     //nb: without this second argument, we don't get the outer directory included, and we need that for the name of the collection
                     zip.AddDirectory(dir, System.IO.Path.GetFileName(dir));
                     zip.Save(path);
                 }
                 //show it
                 Logger.WriteEvent("Showing BloomPack on disk");
                 Process.Start(Path.GetDirectoryName(path));
                 Analytics.Track("Create BloomPack");
             }
             finally
             {
                 Cursor.Current = Cursors.Default;
                 pleaseWait.Close();
             }
         }
     }
     catch (Exception e)
     {
         Palaso.Reporting.ErrorReport.NotifyUserOfProblem(e, "Could not make the BloomPack");
     }
 }