Example #1
0
        /// <summary>
        /// Toggles the expander content.
        /// </summary>
        /// <param name="expanded">
        /// A value indicating whether to toggle expanded.
        /// </param>
        /// <returns>
        /// The <see cref="ExpanderPage"/>.
        /// </returns>
        public ExpanderPage ToggleHorizontalExpander(bool expanded)
        {
            Expander expander = this.WindowsApp.FindElement(this.horizontalExpanderQuery);

            if (expanded)
            {
                expander.Expand();
            }
            else
            {
                expander.Collapse();
            }

            return(this);
        }
Example #2
0
        public MainWindow()
        {
            Dictionary <string, string> Properties = new Dictionary <string, string>();

            System.Reflection.Assembly thisExe;
            thisExe = System.Reflection.Assembly.GetExecutingAssembly();


            try
            {
                Properties = GetProperties("settings.ini");
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show("settings.ini not found");
                Environment.Exit(-1);
            }

            try
            {
                user          = Properties["user"];
                apiKey        = Properties["apiKey"];
                defaultTarget = Properties["targetFile"];
                time          = Properties["time"];
                defaultPrefix = Properties["prefix"];
                //time = "1000";
            }
            catch (KeyNotFoundException ex) {
                MessageBox.Show("settings-key not found (needed variables: user, apiKey, defaultTarget, time, prefix)");
                Environment.Exit(-1);
            }

            if (user == null || apiKey == null || defaultTarget == null || time == null || user.Equals("xxxxxx") || apiKey.Equals("xxxxxx"))
            {
                MessageBox.Show("invalid settings.ini (needed Variables: user, apiKey, defaultTarget, time)");
                Environment.Exit(-1);
            }

            try
            {
                iTime = Convert.ToInt32(time);
                if (iTime < 5000 || iTime > Int32.MaxValue)
                {
                    throw new FormatException();
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("invalid time value (must be numeric and >= 5000): " + time);
                Environment.Exit(-1);
            }

            InitializeComponent();

            timer1.Interval = iTime;

            Expander debugExpander = new Expander();

            debugExpander.Size        = new System.Drawing.Size(325, 230);
            debugExpander.Location    = new System.Drawing.Point(4, 165);
            debugExpander.BorderStyle = BorderStyle.FixedSingle;

            ExpanderHelper.CreateLabelHeader(debugExpander, "Debug-Output", SystemColors.ActiveBorder, new Bitmap(thisExe.GetManifestResourceStream("sbLastFmGetNowPlaying.Resources.ExpandImage.png")), new Bitmap(thisExe.GetManifestResourceStream("sbLastFmGetNowPlaying.Resources.CollapseImage.png")));

            this.tbOutputWindow.Location  = new System.Drawing.Point(0, 0);
            this.tbOutputWindow.Multiline = true;
            this.tbOutputWindow.Name      = "tbOutputWindow";
            this.tbOutputWindow.ReadOnly  = true;
            this.tbOutputWindow.TabIndex  = 7;
            this.tbOutputWindow.Size      = new System.Drawing.Size(debugExpander.Width, 200);
            debugExpander.Content         = tbOutputWindow;
            debugExpander.Collapse();

            ExpanderHelper.CreateLabelHeader(debugExpander, "Debug-Output", SystemColors.ActiveBorder, new Bitmap(thisExe.GetManifestResourceStream("sbLastFmGetNowPlaying.Resources.ExpandImage.png")), new Bitmap(thisExe.GetManifestResourceStream("sbLastFmGetNowPlaying.Resources.CollapseImage.png")));


            this.Controls.Add(debugExpander);
        }