コード例 #1
0
ファイル: helper.cs プロジェクト: teddy9264/KSP_MOCR
        static public OrbitGraph CreateOrbit(int x, int y, int w, int h, bool pixels)
        {
            int width  = (int)Math.Ceiling((w * form.pxPrChar));
            int height = (int)Math.Ceiling(h * form.pxPrLine);
            int top    = (int)(y * form.pxPrLine) + form.padding_top;
            int left   = (int)((x * form.pxPrChar) + form.padding_left);

            if (pixels)
            {
                width  = w;
                height = h;
                left   = x;
                top    = y;
            }

            OrbitGraph orbit = new OrbitGraph(form.buttonFont);

            orbit.Location = new Point(left, top);
            orbit.Size     = new Size(width, height);

            form.Controls.Add(orbit);

            return(orbit);
        }
コード例 #2
0
ファイル: MocrScreen.cs プロジェクト: teddy9264/KSP_MOCR
        //abstract public void destroyStreams();

        public void destroy()
        {
            lock (updateLock)
            {
                // Clear old lables
                foreach (Control label in screenLabels)
                {
                    if (label != null)
                    {
                        label.Dispose();
                    }
                }
                screenLabels.Clear();
                screenLabels.TrimExcess();

                // Clear old Inputs
                foreach (TextBox box in screenInputs)
                {
                    if (box != null)
                    {
                        box.Dispose();
                    }
                }
                screenInputs.Clear();
                screenInputs.TrimExcess();

                // Clear old Buttons
                foreach (MocrButton button in screenButtons)
                {
                    if (button != null)
                    {
                        button.Dispose();
                    }
                }
                screenButtons.Clear();
                screenButtons.TrimExcess();

                // Clear old charts
                foreach (Plot chart in screenCharts)
                {
                    if (chart != null)
                    {
                        chart.Dispose();
                    }
                }
                screenCharts.Clear();
                screenCharts.TrimExcess();

                // Clear old indicators
                foreach (Indicator indicator in screenIndicators)
                {
                    if (indicator != null)
                    {
                        indicator.Dispose();
                    }
                }
                screenIndicators.Clear();
                screenIndicators.TrimExcess();

                // Clear old EngineIndicators
                foreach (EngineIndicator indicator in screenEngines)
                {
                    if (indicator != null)
                    {
                        indicator.Dispose();
                    }
                }
                screenEngines.Clear();
                screenEngines.TrimExcess();

                // Clear old VerticalMeters
                foreach (VerticalMeter meter in screenVMeters)
                {
                    if (meter != null)
                    {
                        meter.Dispose();
                    }
                }
                screenVMeters.Clear();
                screenVMeters.TrimExcess();

                // Clear old 7-segment displays
                foreach (SegDisp disp in screenSegDisps)
                {
                    if (disp != null)
                    {
                        disp.Dispose();
                    }
                }
                screenSegDisps.Clear();
                screenSegDisps.TrimExcess();

                // Clear Drop Downs
                foreach (MocrDropdown drop in screenDropdowns)
                {
                    if (drop != null)
                    {
                        drop.Dispose();
                    }
                }
                screenDropdowns.Clear();
                screenDropdowns.TrimExcess();

                // Clear Maps
                foreach (Map map in screenMaps)
                {
                    if (map != null)
                    {
                        map.Dispose();
                    }
                }
                screenMaps.Clear();
                screenMaps.TrimExcess();

                // Clear Screws
                foreach (Screw screw in screenScrews)
                {
                    if (screw != null)
                    {
                        screw.Dispose();
                    }
                }
                screenScrews.Clear();
                screenScrews.TrimExcess();

                // Clear EventIndicators
                foreach (EventIndicator indicator in screenEventIndicators)
                {
                    if (indicator != null)
                    {
                        indicator.Dispose();
                    }
                }
                screenEventIndicators.Clear();
                screenEventIndicators.TrimExcess();

                // Clear ConsoleDigits
                foreach (ConsoleDigit digit in screenDigits)
                {
                    if (digit != null)
                    {
                        digit.Dispose();
                    }
                }
                screenDigits.Clear();
                screenDigits.TrimExcess();

                // Clear misc controls
                foreach (Control control in screenControls)
                {
                    if (control != null)
                    {
                        control.Dispose();
                    }
                }
                screenControls.Clear();
                screenControls.TrimExcess();

                // Clear old FDAI
                if (screenFDAI != null)
                {
                    screenFDAI.Dispose();
                    screenFDAI = null;
                }

                // Clear old Orbit
                if (screenOrbit != null)
                {
                    screenOrbit.Dispose();
                    screenOrbit = null;
                }

                // Clear all streams
                if (screenStreams != null)
                {
                    screenStreams.CloseStreams();
                    screenStreams = null;
                }
            }
        }