示例#1
0
        public void AnalyzeChepin()
        {
            var defList = new List <string>();
            var varList = new List <string>();

            var result = "Classes and functions span:\n";

            defList = GetVariables(@"(def|class) (\w+)\(?");
            defList.ForEach(d => result += $"{d}: {CountVariables(d) - 1}\n");

            result += "\nVariables span:\n";
            varList = GetVariables(@"( |^)+(\w+) ?= ?");
            varList.ForEach(v => result += $"{v}: {CountVariables(v) - 1}\n");

            var Lines                = Model.Text.Split('\n').ToList();
            var enteredVariables     = ClassifyVariables(Lines, @"(\w+) ?= ?input\(", (count, control) => count == 1 && !control);
            var modifiableVariables  = ClassifyVariables(Lines, @"(\w+) ?= ?", (count, control) => count > 1 && !control);
            var controllingVariables = ClassifyVariables(Lines, @"(\w+) ?= ?", (count, control) => control);
            var parasiteVariables    = ClassifyVariables(Lines, @"(\w+) ?= ?", (count, control) => true).Where(v => !(enteredVariables.Contains(v) ||
                                                                                                                      modifiableVariables.Contains(v) || controllingVariables.Contains(v))).ToList();

            result += $"\nChepin metrics:\n" +
                      $"P = {enteredVariables.Count}\n" +
                      $"M = {modifiableVariables.Count}\n" +
                      $"C = {controllingVariables.Count}\n" +
                      $"T = {parasiteVariables.Count}\n" +
                      $"\nQ = {enteredVariables.Count + 2*modifiableVariables.Count+ 3*controllingVariables.Count+ 0.5*parasiteVariables.Count}";

            var myWindow = new TextWindow(result);

            myWindow.Show();
        }
示例#2
0
 private void ScanISLNestedVerbatimString(ref SyntaxDiagnosticInfo error)
 {
     Debug.Assert(TextWindow.PeekChar() == '@');
     TextWindow.AdvanceChar();
     Debug.Assert(TextWindow.PeekChar() == '\"');
     TextWindow.AdvanceChar(); // move past quote
     while (true)
     {
         if (IsAtEnd())
         {
             // we'll get an error in the enclosing construct
             return;
         }
         char ch = TextWindow.PeekChar();
         TextWindow.AdvanceChar();
         if (ch == '\"')
         {
             if (TextWindow.PeekChar(1) == '\"')
             {
                 TextWindow.AdvanceChar(); // move past escaped quote
             }
             else
             {
                 return;
             }
         }
     }
 }
示例#3
0
文件: Lexer.cs 项目: abock/dotlang
        public Lexer(SourceText sourceText)
        {
            this.sourceText = sourceText
                              ?? throw new ArgumentNullException(nameof(sourceText));

            this.textWindow = new TextWindow(sourceText);
        }
示例#4
0
        /// <summary>
        /// Deze subroutine print alle eigenschappen van een WMI-Class naar de TextWindow.
        /// </summary>
        /// <param name="Win32_Class">De naam van de WMI-Class waarvan de eigenschappen geprint moeten worden.</param>
        /// <returns>Alle eigenschappen van de opgegeven WMI-class</returns>
        public static Primitive PrintAllProperties(Primitive Win32_Class)
        {
            try
            {
                ////Kijkt of Win32_Class met "Win32_" begint.
                //if (!(Win32_Class.ToString().StartsWith("Win32_"))) { Win32_Class = "Win32_" + Win32_Class; }

                //Maak een ManagementObjectSearcher aan.
                ManagementObjectSearcher _searcher = new ManagementObjectSearcher("SELECT * FROM " + Win32_Class);

                //Loop door elk object in de opgegeven class.
                foreach (ManagementObject _mo in _searcher.Get())
                {
                    //Schrijf de naam van het object waar naar gekeken wordt.
                    TextWindow.WriteLine(_mo.Properties["Name"].Value.ToString());

                    //Loop door elke eigenschap van het object.
                    foreach (PropertyData prop in _mo.Properties)
                    {
                        //Print het object als het een waarde heeft.
                        if (prop.Value != null)
                        {
                            TextWindow.WriteLine("--" + prop.Name.ToString() + ": " + prop.Value.ToString());
                        }
                    }

                    TextWindow.WriteLine("");
                }
            }
            catch { }

            return(null);
        }
示例#5
0
        private void buttonBlueTooth_Click(object sender, EventArgs e)
        {
            Primitive encodings = LDBlueTooth.GetEncodings();

            for (int i = 1; i <= SBArray.GetItemCount(encodings); i++)
            {
                TextWindow.WriteLine(encodings[i]);
            }

            Primitive status = LDBlueTooth.Initialise();

            if (status)
            {
                Primitive devices = LDBlueTooth.GetDevices();
                for (int i = 1; i <= SBArray.GetItemCount(devices); i++)
                {
                    TextWindow.WriteLine(devices[i]);
                }
            }
            else
            {
                TextWindow.WriteLine(LDBlueTooth.LastError);
            }
            while (true)
            {
                Program.Delay(100);
            }
        }
示例#6
0
        public XMListItem(string channel)
        {
            System.Reflection.Assembly a  = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.FileInfo         fi = new System.IO.FileInfo(a.Location);

            _channel                 = new TextWindow();
            _channel.Text            = channel;
            _channel.RelativeBounds  = new Rectangle(25, 10, 50, 20);
            _channel.HorizontalAlign = HAlignment.Left;
            Add(_channel);

            _logo                = new Window();
            _logo.Background     = fi.DirectoryName + "\\Images\\" + channel + ".png";
            _logo.RelativeBounds = new Rectangle(25, 30, 80, 40);
            Add(_logo);

            _artist = new TextWindow();
            _artist.RelativeBounds  = new Rectangle(110, 15, 370, 20);
            _artist.HorizontalAlign = HAlignment.Left;
            Add(_artist);

            _song = new TextWindow();
            _song.RelativeBounds  = new Rectangle(110, 35, 370, 20);
            _song.HorizontalAlign = HAlignment.Left;
            Add(_song);

            _album = new TextWindow();
            _album.RelativeBounds  = new Rectangle(110, 55, 370, 20);
            _album.HorizontalAlign = HAlignment.Left;
            Add(_album);

            return;
        }
示例#7
0
        private void buttonMatrix_Click(object sender, EventArgs e)
        {
            int       dim = 16;
            Primitive mat = LDMatrix.Create(dim, dim);

            for (int i = 0; i < dim; i++)
            {
                for (int j = 0; j < dim; j++)
                {
                    //LDMatrix.SetValue(mat, i + 1, j + 1, -SBMath.GetRandomNumber(100) + SBMath.Pi);
                    LDMatrix.SetValue(mat, i + 1, j + 1, SBMath.GetRandomNumber(100));
                }
            }
            //LDMatrix.SetValue(mat, 1, 1, 2);
            //LDMatrix.SetValue(mat, 1, 2, -1);
            //LDMatrix.SetValue(mat, 1, 3, 0);
            //LDMatrix.SetValue(mat, 2, 1, -1);
            //LDMatrix.SetValue(mat, 2, 2, 2);
            //LDMatrix.SetValue(mat, 2, 3, -1);
            //LDMatrix.SetValue(mat, 3, 1, 0);
            //LDMatrix.SetValue(mat, 3, 2, -1);
            //LDMatrix.SetValue(mat, 3, 3, 2);
            Primitive inv = LDMatrix.Create(dim, dim);

            LDMatrix.Inverse(mat, inv);
            Primitive mult = LDMatrix.Create(dim, dim);

            LDMatrix.Multiply(mat, inv, mult);
            LDMatrix.View(mat, "False");
            LDMatrix.Delete(mat);
            LDMatrix.View(inv, "False");
            TextWindow.WriteLine(LDUtilities.KeyDown("Space"));
            TextWindow.WriteLine(LDUtilities.KeyDown("LeftShift"));
        }
示例#8
0
        public async Task <int> PromptBorrow(int MaxLoan)
        {
            var window2 = new TextWindow {
                Location = new Point(8, 7)
            };

            window2.WriteLine("We'd be happy to loan you");
            window2.WriteLine("money at 'friendly' rates");

            var window3 = new TextWindow {
                Location = new Point(7, 11)
            };

            window3.Write("You may borrow up to ");
            window3.Write(MaxLoan.ToString());
            window3.WriteLine(" gold");

            await TextArea.PrintLine();

            await TextArea.PrintLine("Borrow how much?");

            Screen.AddWindow(window2);
            Screen.AddWindow(window3);

            return(await ChooseNumber(MaxLoan));
        }
示例#9
0
        private void buttonColours_Click(object sender, EventArgs e)
        {
            Primitive col = LDColours.SetOpacity("Orange", 100);

            TextWindow.WriteLine(col);
            TextWindow.WriteLine(LDColours.GetOpacity(col));
            TextWindow.WriteLine(LDColours.GetRed(col));
            TextWindow.WriteLine(LDColours.GetGreen(col));
            TextWindow.WriteLine(LDColours.GetBlue(col));

            TextWindow.WriteLine(LDColours.GetHue(col));
            TextWindow.WriteLine(LDColours.GetSaturation(col));
            TextWindow.WriteLine(LDColours.GetLightness(col));
            col = LDColours.HSLtoRGB(LDColours.GetHue(col), LDColours.GetSaturation(col), LDColours.GetLightness(col));
            TextWindow.WriteLine(col);

            for (int i = 0; i < 360; i++)
            {
                GraphicsWindow.BackgroundColor = LDColours.HSLtoRGB(i, 1, 0.5);
                SBProgram.Delay(20);
            }
            LDUtilities.PauseUpdates();
            GraphicsWindow.PenWidth = 0;
            Primitive colour = "Blue";
            Primitive ball   = Shapes.AddEllipse(300, 300);

            Shapes.Move(ball, GraphicsWindow.Width / 2 - 150, GraphicsWindow.Height / 2 - 150);
            LDShapes.BrushColour(ball, LDColours.SetOpacity(colour, 0));
            LDUtilities.ResumeUpdates();
            for (int i = 0; i < 255; i++)
            {
                LDShapes.BrushColour(ball, LDColours.SetOpacity(colour, i));
                SBProgram.Delay(10);
            }
        }
示例#10
0
 private void buttonFile_Click(object sender, EventArgs e)
 {
     TextWindow.WriteLine("Length   " + LDFile.Length("C:\\temp\\testfile.db"));
     TextWindow.WriteLine("Created  " + LDFile.CreationTime("C:\\temp\\testfile.db"));
     TextWindow.WriteLine("Accessed " + LDFile.AccessTime("C:\\temp\\testfile.db"));
     TextWindow.WriteLine("Modified " + LDFile.ModifiedTime("C:\\temp\\testfile.db"));
 }
示例#11
0
 // Start is called before the first frame update
 void Start()
 {
     _messageWindowAnimator = FindObjectOfType <Canvas>().transform.Find("MessageBase").GetComponent <Animator>();
     _objectCamera          = FindObjectsOfType <CinemachineVirtualCamera>().FirstOrDefault(c => c.Priority == 0);
     UnityEngine.Debug.Assert(_messageWindowAnimator != null, "MessageBase not Found");
     _textWindow = _messageWindowAnimator.GetComponent <TextWindow>();
 }
        public iTunesSettingsScreen()
        {
            _options = new TextList();
            Add(_options);

            _url = new TextWindow();
            Add(_url);

            _urlEntry = new TextEntry();
            Add(_urlEntry);

            _password = new TextWindow();
            Add(_password);

            _passwordEntry = new TextEntry();
            Add(_passwordEntry);

            _urlEntry.Accept += new EventHandler(URLEntry_Accept);
            _urlEntry.Cancel += new EventHandler(URLEntry_Cancel);

            _passwordEntry.Accept += new EventHandler(PasswordEntry_Accept);
            _passwordEntry.Cancel += new EventHandler(PasswordEntry_Cancel);

            _options.Focus();
            _options.ItemActivated += new ItemActivatedEventHandler(OnItemActivated);

            return;
        }
示例#13
0
        private SyntaxToken QuickScanSyntaxToken()
        {
            this.Start();
            var state = QuickScanState.Initial;
            int i     = TextWindow.Offset;
            int n     = TextWindow.CharacterWindowCount;

            n = Math.Min(n, i + MaxCachedTokenSize);

            int hashCode = Hash.FnvOffsetBias;

            //localize frequently accessed fields
            var charWindow     = TextWindow.CharacterWindow;
            var charPropLength = s_charProperties.Length;

            for (; i < n; i++)
            {
                char c  = charWindow[i];
                int  uc = unchecked ((int)c);

                var flags = uc < charPropLength ? (CharFlags)s_charProperties[uc] : CharFlags.Complex;

                state = (QuickScanState)s_stateTransitions[(int)state, (int)flags];
                // NOTE: that Bad > Done and it is the only state like that
                // as a result, we will exit the loop on either Bad or Done.
                // the assert below will validate that these are the only states on which we exit
                // Also note that we must exit on Done or Bad
                // since the state machine does not have transitions for these states
                // and will promptly fail if we do not exit.
                if (state >= QuickScanState.Done)
                {
                    goto exitWhile;
                }

                hashCode = unchecked ((hashCode ^ uc) * Hash.FnvPrime);
            }

            state = QuickScanState.Bad; // ran out of characters in window
exitWhile:

            TextWindow.AdvanceChar(i - TextWindow.Offset);
            Debug.Assert(state == QuickScanState.Bad || state == QuickScanState.Done, "can only exit with Bad or Done");

            if (state == QuickScanState.Done)
            {
                // this is a good token!
                var token = _cache.LookupToken(
                    TextWindow.CharacterWindow,
                    TextWindow.LexemeRelativeStart,
                    i - TextWindow.LexemeRelativeStart,
                    hashCode,
                    _createQuickTokenFunction);
                return(token);
            }
            else
            {
                TextWindow.Reset(TextWindow.LexemeStartPosition);
                return(null);
            }
        }
        private static void Main()
        {
            string        picture       = "telerik-academy.jpg";
            PictureWindow pictureWindow = new PictureWindow(picture);

            UseWindow(pictureWindow);

            string     someLongText = "some long text";
            TextWindow textWindow   = new TextWindow(someLongText);

            UseWindow(textWindow);

            string question = "How are you, dude?";

            string[] answers = new string[]
            {
                "I feeeeeeeel good...!",
                "Gonna jump around!",
                "Not bad, really!"
            };

            DialogWindow dialogWindow = new DialogWindow(question, answers);

            UseWindow(dialogWindow);
        }
示例#15
0
        private void buttonUSB_Click(object sender, EventArgs e)
        {
            //Primitive devices = LDHID.AddDevice("046D", "C215", "Joystick");
            Primitive devices = LDHID.FindDevices();

            TextWindow.WriteLine(devices);
        }
示例#16
0
        private void SetWindow(double cost)
        {
            Screen.ClearWindows();

            var promptWindow = new TextWindow();

            promptWindow.Location = new Point(9, 4);

            promptWindow.WriteLine("    Food & water");
            promptWindow.WriteLine();
            promptWindow.WriteLine();
            promptWindow.WriteLine("We sell food for travel.");
            promptWindow.WriteLine("Each 'day' of food will ");
            promptWindow.WriteLine("keep you fed for one day");
            promptWindow.WriteLine("of travel (on foot).    ");
            promptWindow.WriteLine();
            promptWindow.WriteLine();

            if (robbing == false)
            {
                promptWindow.Write("Cost is ");
                promptWindow.Write(cost.ToString());
                promptWindow.WriteLine(" gold per 'day'");
            }
            else
            {
                promptWindow.WriteLine("Robbery in progress");
            }

            promptWindow.SetColor(XleColor.Yellow);

            Screen.AddWindow(promptWindow);
        }
        public XMSettingsScreen()
        {
            _options = new TextList();
            Add( _options );

            _email = new TextWindow();
            Add( _email );

            _emailEntry = new TextEntry();
            Add( _emailEntry );

            _password = new TextWindow();
            Add( _password );

            _passwordEntry = new TextEntry();
            Add( _passwordEntry );

            _emailEntry.Accept += new EventHandler(EmailEntry_Accept);
            _emailEntry.Cancel += new EventHandler(EmailEntry_Cancel);

            _passwordEntry.Accept += new EventHandler(PasswordEntry_Accept);
            _passwordEntry.Cancel += new EventHandler(PasswordEntry_Cancel);

            _options.Focus();
            _options.ItemActivated += new ItemActivatedEventHandler( OnItemActivated );

            return;
        }
示例#18
0
        /// <summary>
        /// Сгенерировать текст нового объекта
        /// </summary>
        /// <param name="splitterObjectType"></param>
        /// <param name="param"></param>
        public void RunSplit(eSplitterObjectType splitterObjectType, eSplitParam param)
        {
            string FinalObjectText = string.Empty;

            // Получаем текст объекта
            switch (splitterObjectType)
            {
            case eSplitterObjectType.OldSpec: FinalObjectText = RunSplitOldSpec(); break;

            case eSplitterObjectType.OldBody: FinalObjectText = RunSplitOldBody(); break;

            case eSplitterObjectType.NewSpec: FinalObjectText = RunSplitNewSpec(param.HasFlag(eSplitParam.GenerateHeader)); break;

            case eSplitterObjectType.NewBody: FinalObjectText = RunSplitNewBody(param.HasFlag(eSplitParam.GenerateHeader)); break;

            default:
                break;
            }

            // Заменяем двойные пробелы - одинарными
            FinalObjectText = Regex.Replace(FinalObjectText, "\r\n\\s*\r\n\\s*\r\n", "\r\n\r\n");

            // Копируем текст в буфер
            if (param.HasFlag(eSplitParam.CopyToClipBoard))
            {
                Clipboard.SetText(FinalObjectText);
            }

            // Открываем текст в новом окне
            if (param.HasFlag(eSplitParam.OpenNewWindow))
            {
                TextWindow tw = new TextWindow(FinalObjectText);
                tw.Show();
            }

            // Обновляем репозиторий
            if (param.HasFlag(eSplitParam.DirectlyUpdateRep))
            {
                RepositoryObject repositoryObject;
                if (splitterObjectType.IsNew())
                {
                    repositoryObject = new RepositoryObject(Config.Instanse().NewPackageName, Config.Instanse().NewPackageOwner, splitterObjectType.IsSpec() ? eRepositoryObjectType.Package_Spec : eRepositoryObjectType.Package_Body);
                }
                else
                {
                    repositoryObject = splitterObjectType.IsSpec() ? _package.repositoryPackage.GetObjectSpec() : _package.repositoryPackage.GetObjectBody();

                    /* Мы должны одновременно обновить в репозитории и спеку и тело
                     * Последовательно мы это сделать не можем, так как генерация текста зависит от обоих частей
                     * Обновляем соседнюю часть:
                     */
                    var SecondParttext = splitterObjectType.IsSpec() ? RunSplitOldBody() : RunSplitOldSpec();
                    var SecondPartObj  = splitterObjectType.IsSpec() ? _package.repositoryPackage.GetObjectBody() : _package.repositoryPackage.GetObjectSpec();
                    DBRep.Instance().SaveTextToFile(SecondParttext, SecondPartObj);
                }

                DBRep.Instance().SaveTextToFile(FinalObjectText, repositoryObject);
            }
        }
 public SayCommand(Scene parent, string message)
     : base(parent)
 {
     this.message = message;
     elapsedTime = new TimeSpan();
     tw = new TextWindow(this, new Rectangle(100, 100, 300, 100));
     sb = new StringBuilder();
 }
示例#20
0
        public Window CreateTextWindow(string title, string text)
        {
            TextWindow textWindow = Instantiate(textWindowPrefab);

            textWindow.Text.text = text;

            return(CreateWindow(title, textWindow.GetComponent <RectTransform>(), true));
        }
示例#21
0
        internal void ScanInterpolatedStringLiteralTop(ArrayBuilder <Interpolation> interpolations, bool isVerbatim, ref TokenInfo info, ref SyntaxDiagnosticInfo error, out bool closeQuoteMissing)
        {
            var subScanner = new InterpolatedStringScanner(this, isVerbatim);

            subScanner.ScanInterpolatedStringLiteralTop(interpolations, ref info, out closeQuoteMissing);
            error     = subScanner.error;
            info.Text = TextWindow.GetText(false);
        }
示例#22
0
        private void SetAskRejectPrice(TextWindow offerWind, int ask, bool wayTooHigh)
        {
            var clr = wayTooHigh ? XleColor.Yellow : XleColor.Cyan;

            offerWind.Clear();
            offerWind.WriteLine(" " + ask + " is " +
                                (wayTooHigh ? "way " : "") + "too high!", clr);
        }
示例#23
0
        private void ScanSingleLineRawStringLiteral(ref TokenInfo info, int startingQuoteCount)
        {
            info.Kind = SyntaxKind.SingleLineRawStringLiteralToken;

            while (true)
            {
                var currentChar = TextWindow.PeekChar();

                // See if we reached the end of the line or file before hitting the end.
                if (SyntaxFacts.IsNewLine(currentChar))
                {
                    this.AddError(TextWindow.Position, width: TextWindow.GetNewLineWidth(), ErrorCode.ERR_UnterminatedRawString);
                    return;
                }
                else if (IsAtEndOfText(currentChar))
                {
                    this.AddError(TextWindow.Position, width: 0, ErrorCode.ERR_UnterminatedRawString);
                    return;
                }

                if (currentChar != '"')
                {
                    // anything not a quote sequence just moves it forward.
                    TextWindow.AdvanceChar();
                    continue;
                }

                var beforeEndDelimiter = TextWindow.Position;
                var currentQuoteCount  = ConsumeQuoteSequence();

                // A raw string literal starting with some number of quotes can contain a quote sequence with fewer quotes.
                if (currentQuoteCount < startingQuoteCount)
                {
                    continue;
                }

                // A raw string could never be followed by another string.  So once we've consumed all the closing quotes
                // if we have any more closing quotes then that's an error we can give a message for.
                if (currentQuoteCount > startingQuoteCount)
                {
                    var excessQuoteCount = currentQuoteCount - startingQuoteCount;
                    this.AddError(
                        position: TextWindow.Position - excessQuoteCount,
                        width: excessQuoteCount,
                        ErrorCode.ERR_TooManyQuotesForRawString);
                }

                // We have enough quotes to finish this string at this point.
                var afterStartDelimiter = TextWindow.LexemeStartPosition + startingQuoteCount;
                var valueLength         = beforeEndDelimiter - afterStartDelimiter;

                info.StringValue = TextWindow.GetText(
                    position: afterStartDelimiter,
                    length: valueLength,
                    intern: true);
                return;
            }
        }
示例#24
0
        private void AddMultiLineRawStringLiteralLineContents(
            StringBuilder indentationWhitespace,
            StringBuilder currentLineWhitespace,
            bool firstContentLine)
        {
            Debug.Assert(SyntaxFacts.IsNewLine(TextWindow.PeekChar()));

            var newLineWidth = TextWindow.GetNewLineWidth();

            for (var i = 0; i < newLineWidth; i++)
            {
                // the initial newline in `"""   \r\n` is not added to the contents.
                if (!firstContentLine)
                {
                    _builder.Append(TextWindow.PeekChar());
                }

                TextWindow.AdvanceChar();
            }

            var lineStartPosition = TextWindow.Position;

            currentLineWhitespace.Clear();
            ConsumeWhitespace(currentLineWhitespace);

            if (!StartsWith(currentLineWhitespace, indentationWhitespace))
            {
                // We have a line where the indentation of that line isn't a prefix of indentation
                // whitespace.
                //
                // If we're not on a blank line then this is bad.  That's a content line that doesn't start
                // with the indentation whitespace.  If we are on a blank line then it's ok if the whitespace
                // we do have is a prefix of the indentation whitespace.
                var isBlankLine      = SyntaxFacts.IsNewLine(TextWindow.PeekChar());
                var isLegalBlankLine = isBlankLine && StartsWith(indentationWhitespace, currentLineWhitespace);
                if (!isLegalBlankLine)
                {
                    // Specialized error message if this is a spacing difference.
                    if (CheckForSpaceDifference(
                            currentLineWhitespace, indentationWhitespace,
                            out var currentLineWhitespaceChar, out var indentationWhitespaceChar))
                    {
                        this.AddError(
                            lineStartPosition,
                            width: TextWindow.Position - lineStartPosition,
                            ErrorCode.ERR_LineContainsDifferentWhitespace,
                            currentLineWhitespaceChar, indentationWhitespaceChar);
                    }
                    else
                    {
                        this.AddError(
                            lineStartPosition,
                            width: TextWindow.Position - lineStartPosition,
                            ErrorCode.ERR_LineDoesNotStartWithSameWhitespace);
                    }
                    return;
                }
            }
示例#25
0
        private void ScanISLContents(ArrayBuilder <Interpolation> interpolations, ref SyntaxDiagnosticInfo error)
        {
            while (true)
            {
                if (IsAtEnd())
                {
                    // error: end of line before end of string
                    return;
                }
                switch (TextWindow.PeekChar())
                {
                case '\"':
                    // found the end of the string
                    return;

                case '\\':
                    TextWindow.AdvanceChar();
                    if (IsAtEnd())
                    {
                        // the caller will complain about unclosed quote
                        return;
                    }
                    else if (TextWindow.PeekChar() == '{')
                    {
                        int interpolationStart = TextWindow.Position;
                        TextWindow.AdvanceChar();
                        ScanISLHoleBalancedText('}', true, ref error);
                        int end = TextWindow.Position;
                        if (TextWindow.PeekChar() == '}')
                        {
                            TextWindow.AdvanceChar();
                        }
                        else
                        {
                            if (error == null)
                            {
                                error = MakeError(interpolationStart - 1, 2, ErrorCode.ERR_UnclosedExpressionHole);
                            }
                        }
                        if (interpolations != null)
                        {
                            interpolations.Add(new Interpolation(interpolationStart, end));
                        }
                    }
                    else
                    {
                        TextWindow.AdvanceChar();     // skip past a single escaped character
                    }
                    continue;

                default:
                    // found some other character in the string portion
                    TextWindow.AdvanceChar();
                    continue;
                }
            }
        }
示例#26
0
        public void Rectangle_Decorated_With_CurlyBrackets()
        {
            Glyph  row    = new CurlyBracketsDecorator(new Rectangle());
            Window window = new TextWindow(new SimpleTextWindowImp());

            row.Draw(window);

            Assert.AreEqual("{Rectangle}", window.DrawnText);
        }
示例#27
0
        public void Display(Primitive rootObject)
        {
            if (typeList.Count == 0)
            {
                GetTypes();
            }
            try
            {
                foreach (Type type in typeList)
                {
                    //if (type.Name == "GraphicsWindow")
                    {
                        TextWindow.WriteLine(type.Namespace + " : " + type.Name);
                        BindingFlags bf = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;
                        //foreach (MemberInfo info in type.GetMembers(bf))
                        //{
                        //    TextWindow.WriteLine("    Member : " + info.Name);
                        //}
                        foreach (MethodInfo info in type.GetMethods(bf))
                        {
                            TextWindow.WriteLine("    Method : " + info.Name);
                        }
                        foreach (PropertyInfo info in type.GetProperties(bf))
                        {
                            TextWindow.WriteLine("    Property : " + info.Name);
                        }
                        foreach (FieldInfo info in type.GetFields(bf))
                        {
                            TextWindow.WriteLine("    Field : " + info.Name);
                        }
                        foreach (EventInfo info in type.GetEvents(bf))
                        {
                            TextWindow.WriteLine("    Event : " + info.Name);
                        }
                    }
                }
                Object obj = (Object)GetType("GraphicsWindow").GetField(rootObject, BindingFlags.IgnoreCase | BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);

                if (null == obj)
                {
                    return;
                }

                InvokeHelper invokeHelper = delegate
                {
                    PropertyGrid.SelectedObject = obj;
                    ShowDialog();
                };

                mInvoke.Invoke(null, new object[] { invokeHelper });
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }
        }
示例#28
0
        private void InitializeEnergy()
        {
            GameObject energy = GetElement("Energy");

            if (energy != null)
            {
                energyWidget = new TextWindow(energy, "Text", "");
                energyWidget.Reset();
            }
        }
示例#29
0
        private void SetDescriptionText()
        {
            TextWindow window = new TextWindow();

            window.Location = new Point(7, 3);
            window.WriteLine("Our sect offers restorative");
            window.WriteLine("    cures for your wounds.");

            Screen.AddWindow(window);
        }
示例#30
0
        public YahooTrailersListItem(string caption)
        {
            _title                 = new TextWindow();
            _title.Text            = caption;
            _title.RelativeBounds  = new Rectangle(70, 10, 640, 30);
            _title.HorizontalAlign = HAlignment.Left;
            Add(_title);

            return;
        }
示例#31
0
 /// <summary>
 /// Starts the engine, trying to run at the given framerate.
 /// </summary>
 /// <param name="fps">The target framerate</param>
 public static void Start(Primitive fps)
 {
     try {
         SmallTK.GameEngine.Start(fps);
     }
     catch (Exception e) {
         TextWindow.Show();
         Console.WriteLine(e);
     }
 }
示例#32
0
    public async ValueTask <string> ShowTextWindowAsync()
    {
        return(await _applicationDispatcher.InvokeAsync(async() =>
        {
            var window = new TextWindow();
            await window.ShowDialog(_mainWindowProvider.GetMainWindow());

            return window.ViewModel?.GetResult() ?? string.Empty;
        }));
    }
示例#33
0
        /// <summary>
        /// Creates a new ComicListItem
        /// </summary>
        /// <param name="text">Text to place in the caption</param>
        /// <param name="fileName">Full path to the comic image</param>
        public ComicListItem( string text, string fileName )
        {
            _caption = new TextWindow();
            _caption.Text = text;
            Add( _caption );

            _comic = new Window();
            _comic.Background = fileName;
            _comic.StretchBackground = false;
            Add( _comic );

            _fullName = fileName;
            return;
        }
        /// <summary>
        /// Creates the ComicsScreen
        /// </summary>
        public YahooTrailersDetailsScreen()
        {
            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.FileInfo fi = new System.IO.FileInfo( a.Location );

            homedir = fi.DirectoryName;

            // Text Objects
            _header = new TextWindow();
            Add( _header );

            _poster = new PosterWindow();
            Add( _poster );

            _details = new TextWindow();
            Add( _details );

            _starring = new TextWindow();
            Add( _starring );

            _genre = new TextWindow();
            Add( _genre );

            _releasedate = new TextWindow();
            Add( _releasedate );

            _rating = new TextWindow();
            Add( _rating );

            _trailers = new VariableItemList();
            Add( _trailers );
            _trailers.ItemActivated += new ItemActivatedEventHandler(List_ItemActivated);
            _trailers.Visible = true;
            _trailers.Focus();

            // Logo
            _yahoologo = new Window();
            Add( _yahoologo );

            // Downloading logo
            _downloading = new Window();
            Add( _downloading );

            // Create the timer
            updateTimer = new System.Windows.Forms.Timer();
            updateTimer.Interval = 250;
            updateTimer.Tick += new EventHandler(updateTimer_Tick);
            updateTimer.Start();
        }
        /// <summary>
        /// Creates the Screen
        /// </summary>
        public YahooTrailersScreen()
        {
            SnapStream.Logging.WriteLog("YahooTrailers Plugin Started");

            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.FileInfo fi = new System.IO.FileInfo( a.Location );

            homedir = fi.DirectoryName;

            // Text Objects
            _header = new TextWindow();
            Add( _header );

            // Text Button for the library
            _library = new TextButton();
            _library.Click +=new EventHandler(_library_Click);
            Add( _library );

            // Text Button for the view
            _view = new TextButton();
            _view.Click +=new EventHandler(_view_Click);
            Add( _view );

            // Create the list viewer
            _trailerlist = new VariableItemList();
            Add( _trailerlist );
            _trailerlist.ItemActivated += new ItemActivatedEventHandler(List_ItemActivated);
            _trailerlist.Visible = true;
            _trailerlist.Focus();

            // Logo
            _yahoologo = new Window();
            Add( _yahoologo );

            // Downloading logo
            _downloading = new Window();
            Add( _downloading );

            // Get the trailers
            GetTrailers();

            // Create the timer
            updateTimer = new System.Windows.Forms.Timer();
            updateTimer.Interval = 250;
            updateTimer.Tick += new EventHandler(updateTimer_Tick);
            updateTimer.Start();

            return;
        }
示例#36
0
        /// <summary>
        /// Creates the ComicsScreen
        /// </summary>
        public ComicsScreen()
        {
            SnapStream.Logging.WriteLog("Comics Plugin Started");

            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.FileInfo fi = new System.IO.FileInfo( a.Location );

            _homeDirectory = fi.DirectoryName;

            // Create a new updater
            //_updater = new ComicsUpdater();
            SingletonComicsUpdater.Instance.Initialize( fi.DirectoryName );

            // Register the handler for changing days
            daysChanged.Execute += new CommandExecuteHandler( daysChanged_Execute );

            // Text Objects
            // Show the instructions
            _instructions = new TextWindow();
            Add( _instructions );

            // Create the viewer window for the comics
            _comicsViewer = new VariableItemList();
            Add( _comicsViewer );

            // Sort by option
            _sortBy = new OptionList();
            _sortBy.DefaultItemTextHeightPercent = 0.5;
            OptionListItem byWhat = new OptionListItem("Sort By");
            byWhat.AddSelectorItem("Date","Date");
            byWhat.AddSelectorItem("Comic","Comic");
            _sortBy.AddItem(byWhat);
            Add ( _sortBy );
            byWhat.SelectorValueChanged += new SelectorValueChangedEventHandler( sortBy_SelectorValueChanged );
            _sortBy.Visible = false;

            _comicsViewer.ItemActivated += new ItemActivatedEventHandler(ComicsViewer_ItemActivated);
            _comicsViewer.Visible = true;
            _comicsViewer.Focus();
            _comicsViewer.Height = 480;
            this.Render();

            _comicsViewer.HighlightItemImage = String.Empty;
            _comicsViewer.DefaultItemImage = String.Empty;

            return;
        }
        public iTunesSearchScreen()
        {
            _options = new TextList();
            Add( _options );

            _search = new TextWindow();
            Add( _search );

            _searchEntry = new TextEntry();
            Add( _searchEntry );

            _searchEntry.Accept += new EventHandler(SearchEntry_Accept);
            _searchEntry.Cancel += new EventHandler(SearchEntry_Cancel);

            _options.Focus();
            _options.ItemActivated += new ItemActivatedEventHandler( OnItemActivated );

            return;
        }
        public ComicsSubscriptionsScreen()
        {
            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.FileInfo fi = new System.IO.FileInfo( a.Location );

            // Instructions if no comics are in the XML
            _instructions = new TextWindow();
            Add( _instructions );

            // Show comics from XML
            _availableComics = new TextList();
            Add( _availableComics );

            _availableComics.Focus();
            _availableComics.ItemActivated += new ItemActivatedEventHandler( OnItemActivated );

            // Initialize the sort by variable if it isn't set
            if (!SingletonConfig.Instance.IsSet( "Comics.SortBy" ))
                SingletonConfig.Instance.SetProperty( "Comics.SortBy", "Date" );

            return;
        }
 private void NPCQueryButton_Click(object sender, RoutedEventArgs e)
 {
     var window = new TextWindow(EditorViewModel.NPCQuery());
     window.ShowDialog();
 }
示例#40
0
        public iTunesListItem( string channel )
        {
            _artist = new TextWindow();
            _artist.RelativeBounds = new Rectangle(70,10,190,20);
            _artist.HorizontalAlign = HAlignment.Left;
            Add( _artist );

            _song = new TextWindow();
            _song.RelativeBounds = new Rectangle(270,10,190,20);
            _song.HorizontalAlign = HAlignment.Left;
            Add( _song );

            _album = new TextWindow();
            _album.RelativeBounds = new Rectangle(470,10,190,20);
            _album.HorizontalAlign = HAlignment.Left;
            Add( _album );

            return;
        }
        public void addStarring( string starring )
        {
            _starringWindow = new TextWindow();
            _starringWindow.Text = starring;
            _starringWindow.FontSize = 18;
            _starringWindow.RelativeBounds = new Rectangle(70,45,640,30);
            _starringWindow.HorizontalAlign = HAlignment.Left;
            Add( _starringWindow );

            return;
        }
 private void Button_Click_5(object sender, RoutedEventArgs e)
 {
     if (ViewModel.SelectedLootDrop == null) return;
     var sql = ViewModel.SelectedLootDrop.GetSQL();
     var window = new TextWindow(sql);
     window.ShowDialog();
 }
 private void ViewQueryButton_Click(object sender, RoutedEventArgs e)
 {
     if (GridsViewModel.GridsService != null && GridsViewModel.GridsService.ZoneGrids != null)
     {
         //SaveFileDialog sd = new SaveFileDialog();
         //if ((bool)sd.ShowDialog())
         //{
         //    GridsViewModel.GridsService.ZoneGrids.SaveQueryToFile(sd.FileName);
         //}
         var window = new TextWindow(GridsViewModel.GridsService.ZoneGrids.GetSQL());
         window.Title = "Update Query";
         window.Show();
         return;
     }
 }
示例#44
0
        private void BringUpLicenseWindow()
        {
            if (m_LicenseWindow == null)
            {
                Assembly assembly = Assembly.GetExecutingAssembly();
                Stream stream = assembly.GetManifestResourceStream("Auremo.Text.LICENSE.txt");
                StreamReader reader = new StreamReader(stream, Encoding.UTF8);
                string license = reader.ReadToEnd();

                m_LicenseWindow = new TextWindow("License - Auremo MPD Client", license, this);
            }
            else
            {
                m_LicenseWindow.Visibility = Visibility.Visible;
            }

            m_LicenseWindow.Show();
        }
示例#45
0
 public void OnChildWindowClosing(Window window)
 {
     if (window == m_AboutWindow)
     {
         m_AboutWindow = null;
     }
     else if (window == m_LicenseWindow)
     {
         m_LicenseWindow = null;
     }
     else if (window == m_SettingsWindow)
     {
         m_SettingsWindow = null;
     }
 }
        public YahooTrailersListItem( string caption )
        {
            _title = new TextWindow();
            _title.Text = caption;
            _title.RelativeBounds = new Rectangle(70,10,640,30);
            _title.HorizontalAlign = HAlignment.Left;
            Add( _title );

            return;
        }
        private void CompilePluginsDirectory()
        {
            var compiler = new Microsoft.CSharp.CSharpCodeProvider();
            var parms = new CompilerParameters()
            {
                GenerateExecutable = false,
                GenerateInMemory = true
            };
            parms.ReferencedAssemblies.Add("System.Core.dll");
            parms.ReferencedAssemblies.Add("EQEmu.dll");

            var files = Directory.GetFiles(".\\Plugins");
            if (files.Count() > 0)
            {
                files = files.Where(x => x.Contains(".cs")).ToArray();
                if (files.Count() > 0)
                {
                    var results = compiler.CompileAssemblyFromFile(parms, files);
                    if (results.Errors.HasErrors)
                    {
                        string errorMessage = "There were compilation errors from source files in the plugin directory:" + System.Environment.NewLine; ;
                        foreach (var err in results.Errors)
                        {
                            errorMessage += err.ToString() + System.Environment.NewLine;
                        }

                        var window = new TextWindow(errorMessage);
                        window.ShowDialog();
                    }
                    else
                    {
                        //the get accessor loads the assembly into the appdomain
                        var assembly = results.CompiledAssembly;
                    }
                }
            }
        }
 private void ViewQueryButton_Click(object sender, RoutedEventArgs e)
 {
     if (SpawnsViewModel.SpawnsService != null && SpawnsViewModel.SpawnsService.ZoneSpawns != null)
     {
         var window = new TextWindow(SpawnsViewModel.SpawnsService.ZoneSpawns.GetSQL());
         window.ShowDialog();
     }
 }
 private void ViewQueryButton_Click(object sender, RoutedEventArgs e)
 {
     if (RoamAreaViewModel != null && RoamAreaViewModel.RoamAreasDataService != null)
     {
         var za = RoamAreaViewModel.RoamAreasDataService.ZoneAreas;
         if (za != null)
         {
             var window = new TextWindow(za.GetSQL());
             window.ShowDialog();
         }
     }
 }
 private void ViewQueryButton_Click(object sender, RoutedEventArgs e)
 {
     if (GroundSpawnsViewModel.GroundSpawnsService != null)
     {
         var window =
             new TextWindow(
                 GroundSpawnsViewModel.GroundSpawnsService.ZoneGroundSpawns.GetSQL());
         window.Show();
     }
 }
示例#51
0
        /// <summary>
        /// Creates the ComicsScreen
        /// </summary>
        public iTunesScreen()
        {
            SnapStream.Logging.WriteLog("iTunes Plugin Started");

            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.FileInfo fi = new System.IO.FileInfo( a.Location );

            // Text Objects
            _header = new TextWindow();
            Add( _header );

            _volume = new TextWindow();
            Add( _volume );

            // Create the list viewer
            _list = new VariableItemList();
            //Add( _list );

            // Create control button
            _nextButton = new TextButton();
            _nextButton.Click +=new EventHandler(_nextButton_Click);
            Add(_nextButton);

            // Create control button
            _shuffleButton = new TextButton();
            _shuffleButton.Click +=new EventHandler(_shuffleButton_Click);
            Add(_shuffleButton);

            // Create control button
            _searchButton = new TextButton();
            _searchButton.Click +=new EventHandler(_searchButton_Click);
            Add(_searchButton);

            // Search
            _searchEntry = new TextEntry();
            Add( _searchEntry );
            _searchEntry.Accept += new EventHandler(SearchEntry_Accept);
            _searchEntry.Cancel += new EventHandler(SearchEntry_Cancel);

            // Create control button
            _playallButton = new TextButton();
            _playallButton.Click +=new EventHandler(_playallButton_Click);
            Add(_playallButton);

            _list.ItemActivated += new ItemActivatedEventHandler(List_ItemActivated);
            _list.Visible = true;
            _list.Focus();

            misc1 = new TextWindow();
            misc1.RelativeBounds = new Rectangle(210,170,200,40);
            misc1.FontSize = 20;
            misc1.Text = "(N or >> button on Firefly)";
            Add(misc1);

            misc2 = new TextWindow();
            misc2.RelativeBounds = new Rectangle(210,210,300,40);
            misc2.FontSize = 20;
            misc2.Text = "(S or A button on Firefly)";
            Add(misc2);

            misc3 = new TextWindow();
            misc3.RelativeBounds = new Rectangle(0,240,400,40);
            misc3.FontSize = 20;
            misc3.Text = "+/- controls volume on keyboard and Firefly remote";
            Add(misc3);

            // Create the windows media player object
            wmp = new WMPLib.WindowsMediaPlayerClass();

            // Create the timer
            updateTimer = new Timer();
            updateTimer.Interval = 1000;
            updateTimer.Tick += new EventHandler(updateTimer_Tick);

            return;
        }
示例#52
0
        private void OnExit(object sender, System.ComponentModel.CancelEventArgs e)
        {
            DataModel.QuickSearch.Terminate();
            DataModel.ServerSession.OnlineMode = false;

            if (m_SettingsWindow != null)
            {
                m_SettingsWindow.Close();
                m_SettingsWindow = null;
            }

            if (m_LicenseWindow != null)
            {
                m_LicenseWindow.Close();
                m_LicenseWindow = null;
            }

            if (m_AboutWindow != null)
            {
                m_AboutWindow.Close();
                m_AboutWindow = null;
            }

            SaveWindowState();
        }
 private void ViewQueryButton_Click(object sender, RoutedEventArgs e)
 {
     if (DoorsViewModel != null)
     {
         if (DoorsViewModel.DoorService != null && DoorsViewModel.DoorService.DoorManager != null)
         {
             var window = new TextWindow(DoorsViewModel.DoorService.DoorManager.GetSQL());
             window.ShowDialog();
         }
     }
 }
 private void ViewQueryButton_Click(object sender, RoutedEventArgs e)
 {
     var sql = NpcEditViewModel.NpcManager.GetSQL();
     var window = new TextWindow(sql);
     window.ShowDialog();
 }
        public Trailer( string title, string display, string format )
        {
            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.FileInfo fi = new System.IO.FileInfo( a.Location );

            _title = title;

            _display = new TextWindow();
            _display.Text = display;
            _display.RelativeBounds = new Rectangle(80,5,200,25);
            _display.HorizontalAlign = HAlignment.Left;
            Add( _display );

            _logo = new Window();
            if (format.Equals("480p"))
                _logo.Background = fi.DirectoryName + "\\qtlogo480p.png";
            else if (format.Equals("720p"))
                _logo.Background = fi.DirectoryName + "\\qtlogo720p.png";
            else if (format.Equals("1080p"))
                _logo.Background = fi.DirectoryName + "\\qtlogo1080p.png";
            else
                _logo.Background = fi.DirectoryName + "\\qtlogo.png";
            _logo.RelativeBounds = new Rectangle(20,7,20,20);
            Add( _logo );

            _controlbutton = new Window();
            if (title.StartsWith("PLAY"))
                _controlbutton.Background = fi.DirectoryName + "\\play.png";
            else
                _controlbutton.Background = fi.DirectoryName + "\\download.png";
            _controlbutton.RelativeBounds = new Rectangle(50,7,20,20);
            Add( _controlbutton );

            return;
        }
示例#56
0
        public XMListItem( string channel )
        {
            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.FileInfo fi = new System.IO.FileInfo( a.Location );

            _channel = new TextWindow();
            _channel.Text = channel;
            _channel.RelativeBounds = new Rectangle(25,10,50,20);
            _channel.HorizontalAlign = HAlignment.Left;
            Add( _channel );

            _logo = new Window();
            _logo.Background = fi.DirectoryName + "\\Images\\" + channel + ".png";
            _logo.RelativeBounds = new Rectangle(25,30,80,40);
            Add( _logo );

            _artist = new TextWindow();
            _artist.RelativeBounds = new Rectangle(110,15,370,20);
            _artist.HorizontalAlign = HAlignment.Left;
            Add( _artist );

            _song = new TextWindow();
            _song.RelativeBounds = new Rectangle(110,35,370,20);
            _song.HorizontalAlign = HAlignment.Left;
            Add( _song );

            _album = new TextWindow();
            _album.RelativeBounds = new Rectangle(110,55,370,20);
            _album.HorizontalAlign = HAlignment.Left;
            Add( _album );

            return;
        }
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     var sql = _viewModel.GetSQL();
     var window = new TextWindow(sql);
     window.ShowDialog();
 }
示例#58
0
        /// <summary>
        /// Creates the ComicsScreen
        /// </summary>
        public XMRadioScreen()
        {
            SnapStream.Logging.WriteLog("XMRadio Plugin Started");

            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            fi = new System.IO.FileInfo( a.Location );

            // XM Logo
            _logo = new Window();
            _logo.Background = fi.DirectoryName + "\\Images\\" + "xmlogo.png";
            Add(_logo);

            // Channel Logo
            Window _logobg = new Window();
            _logobg.RelativeBounds = new Rectangle(44,30,60,30);
            _logobg.Background = fi.DirectoryName + "\\Images\\" + "blackpixel.png";
            Add( _logobg );

            _logo2 = new TextWindow();
            _logo2.Background = fi.DirectoryName + "\\Images\\" + "blackpixel.png";
            Add(_logo2);

            // Now Playing header
            _header = new TextWindow();
            _header.Color = System.Drawing.Color.FromArgb(255,224,16);
            _header.Background = fi.DirectoryName + "\\Images\\" + "blackpixel.png";
            Add( _header );

            // Now Playing header2
            _header2 = new TextWindow();
            _header2.Color = System.Drawing.Color.FromArgb(255,224,16);
            _header2.Background = fi.DirectoryName + "\\Images\\" + "blackpixel.png";
            Add( _header2 );

            // Volume control
            _volume = new TextWindow();
            Add( _volume );

            // Create the genre listing
            _xmGenres = new VariableItemList();
            _xmGenres.ItemActivated +=new ItemActivatedEventHandler(_xmGenres_ItemActivated);
            _xmGenres.ScrollBar.Visible = false;
            _xmGenres.GridPadding = 0;
            Add( _xmGenres );

            // Create the channel listing
            _xmChannels = new VariableItemList();
            _xmChannels.ItemActivated += new ItemActivatedEventHandler(XMChannels_ItemActivated);
            Add( _xmChannels );

            // Create the favorites listing
            _xmFavs = new VariableItemList();
            _xmFavs.ItemActivated +=new ItemActivatedEventHandler(_xmFavs_ItemActivated);
            _xmFavs.ScrollBar.Visible = false;
            Add( _xmFavs );

            // Create the windows media player object
            wmp = new WMPLib.WindowsMediaPlayerClass();

            // Create the timer
            updateTimer = new Timer();
            updateTimer.Interval = 5000;
            updateTimer.Tick += new EventHandler(updateTimer_Tick);

            return;
        }
示例#59
0
 public TextWindow AddTextWindow(string text, Gdk.Color color, int x, int y)
 {
     TextWindow tw = new TextWindow (text, color, x, y);
     AddWindow (tw);
     return tw;
 }
        private void InitCommands()
        {
            RemoveSelectedEntryCommand = new DelegateCommand(
                x =>
                {
                    var entry = x as SpawnEntry;
                    if (entry != null && SelectedSpawnGroup != null)
                    {
                        SelectedSpawnGroup.RemoveEntry(entry);
                    }
                },
                x =>
                {
                    if (SelectedSpawnGroup != null && ((x as SpawnEntry) != null)) return true;
                    else return false;
                });

            ViewQueryCommand = new DelegateCommand(
                x =>
                {
                    var window = new TextWindow(_manager.GetSQL());
                    window.Show();
                },
                x =>
                {
                    return true;
                });

            CreateNewCommand = new DelegateCommand(
                x =>
                {
                    var sg = _manager.CreateSpawnGroup();
                    _manager.AddSpawnGroup(sg);
                    if (sg != null)
                    {
                        SelectedSpawnGroup = sg;
                    }
                    NotifyPropertyChanged("SpawnGroups");
                },
                x =>
                {
                    return true;
                });

            NextIdCommand = new DelegateCommand(
                x =>
                {
                    var sorted = _manager.SpawnGroups.OrderBy(g => { return g.Id; });

                    if (SelectedSpawnGroup.Id == sorted.Last().Id)
                    {
                        SelectedSpawnGroup = sorted.First();
                    }
                    else
                    {
                        SelectedSpawnGroup = sorted.First(g => { return g.Id > SelectedSpawnGroup.Id; });
                    }
                },
                x =>
                {
                    if (_manager.SpawnGroups.Count() > 1 && SelectedSpawnGroup != null)
                    {
                        return true;
                    }
                    else return false;
                });

            PreviousIdCommand = new DelegateCommand(
                x =>
                {
                    var sorted = _manager.SpawnGroups.OrderBy(g => { return g.Id; });

                    if (SelectedSpawnGroup.Id == sorted.First().Id)
                    {
                        SelectedSpawnGroup = sorted.Last();
                    }
                    else
                    {
                        SelectedSpawnGroup = sorted.Last(g => { return g.Id < SelectedSpawnGroup.Id; });
                    }
                },
                x =>
                {
                    if (_manager.SpawnGroups.Count() > 1 && SelectedSpawnGroup != null)
                    {
                        return true;
                    }
                    else return false;
                });

            RemoveSpawnGroupCommand = new DelegateCommand(
                x =>
                {
                    _manager.RemoveSpawnGroup(SelectedSpawnGroup);

                    if (_manager.SpawnGroups.Count() > 0)
                    {
                        SelectedSpawnGroup = _manager.SpawnGroups.ElementAt(0);
                    }
                    else SelectedSpawnGroup = null;
                    NotifyPropertyChanged("SpawnGroups");
                },
                x =>
                {
                    return SelectedSpawnGroup != null;
                });

            AdjustChanceTotalCommand = new DelegateCommand(
                x =>
                {
                    var entries = x as IEnumerable<object>;

                    if (entries != null && entries.Count() > 0)
                    {
                        var total = SelectedSpawnGroup.ChanceTotal;
                        var unitsLeft = 100 - total;

                        while (unitsLeft > 1)
                        {
                            foreach (SpawnEntry entry in entries)
                            {
                                entry.Chance += 1;
                                unitsLeft--;
                                if (unitsLeft == 0) break;
                            }
                        }
                    }
                    else return;
                },
                x =>
                {
                    return SelectedSpawnGroup != null && SelectedSpawnGroup.Entries.Count > 0;
                });

            ClearCacheCommand = new DelegateCommand(
                x =>
                {
                    _manager.ClearCache();
                    SelectedSpawnGroup = null;
                    ClearCacheCommand.RaiseCanExecuteChanged();
                    NotifyPropertyChanged("SpawnGroups");
                },
                x =>
                {
                    return _manager.SpawnGroups.Count() > 0;
                });

            PackCommand = new DelegateCommand(
                x =>
                {
                    PackIds();
                },
                x =>
                {
                    if (_packWork != null && _packWork.IsBusy) return false;
                    return (PackEnd > PackStart && PackEnd - PackStart > _manager.SpawnGroups.Count());
                });
        }