// Handles clicking a hyperlink
        public void HandleNoteLink(object sender, Hyperlink h)
        {
            // get all the files in the user's documents and search for a match with the sent hyper link
            var files = Directory.GetFiles(defaultFolder, "*").Select(f => Path.GetFileName(f));

            if (files.Contains(System.IO.Path.GetFileName(h.NavigateUri.OriginalString)))
            {
                bool trigger = false;
                for (int i = 0; i < tabItems.Count; i++)
                {
                    if (tabItems[i].Header == System.IO.Path.GetFileNameWithoutExtension(h.NavigateUri.OriginalString))
                    {
                        trigger = true;
                        TabControl1.SelectedIndex = i;
                    }
                }
                if (!trigger)
                {
                    addTab(Path.GetFileNameWithoutExtension(h.NavigateUri.OriginalString));
                    TabControl1.SelectedIndex = tabItems.Count - 1;
                    activeBox = tabItems[TabControl1.SelectedIndex].Content;
                    LoadXamlPackage(h.NavigateUri.LocalPath);
                }
            }
            else
            {
                addTab(new TextRange(h.ContentStart, h.ContentEnd).Text);
                TabControl1.SelectedIndex = tabItems.Count - 1;
                LoadXamlPackage(h.NavigateUri.LocalPath);
            }
        }
        public void HandleTextUpdate(object sender, SpecialBox b)
        {
            Trace.WriteLine("clicked!");
            var temp = activeBox.CaretPosition.Paragraph.Inlines.FirstInline.Style;

            //GetPropertyValue(Inline.FontWeightProperty);
            cmbFontFamily.SelectedItem = temp;
        }
        // fires when a new tab is selected
        private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var tc = sender as TabControl;

            if (tc != null)
            {
                MyTabItem item = (MyTabItem)tc.SelectedItem;
                activeBox = item.Content;
            }
        }
        public Form_AddSpecialItem(ref SpecialBox SpecialBox)
        {
            base.Load += Form_AddSpecialItem_Load;
            InitializeComponent();
            StyleManager.UpdateAmbientColors(this);
            wType       = WindowType.SpecialBox;
            specialData = SpecialBox;
            {
                var withBlock = specialData;
                IntegerInput_Alpha.Value = Conversions.ToInteger(Math.Round(withBlock.Alpha / (double)255 * 100));
                IntegerInput_Scale.Value = withBlock.Scale;
                LabelX_Height.Text       = string.Format("Height: {0}", SpecialBox.Y);
                LabelX_Pos1.Text         = string.Format("Edge 1: {0}, {1}", withBlock.X1, withBlock.Z1);
                LabelX_Pos2.Text         = string.Format("Edge 2: {0}, {1}", withBlock.X2, withBlock.Z2);
            }

            var switchExpr = SpecialBox.WaterType;

            switch (switchExpr)
            {
            case WaterType.Default:
                ComboBox_WaterType.SelectedIndex = SpecialBox.InvisibleWater ? 1 : 0;
                break;

            case WaterType.JRBWater:
                ComboBox_WaterType.SelectedIndex = 2;
                break;

            case WaterType.GreenWater:
                ComboBox_WaterType.SelectedIndex = 3;
                break;

            case WaterType.LavaWater:
                ComboBox_WaterType.SelectedIndex = 4;
                break;
            }

            var switchExpr1 = SpecialBox.Type;

            switch (switchExpr1)
            {
            case SpecialBoxType.Water:
                CheckBoxX_Water.Checked = true;
                break;

            case SpecialBoxType.ToxicHaze:
                CheckBoxX_ToxicHaze.Checked = true;
                break;

            case SpecialBoxType.Mist:
                CheckBoxX_Mist.Checked = true;
                break;
            }
        }
Example #5
0
        public static void ReorderBoxDataPositions(SpecialBox SpecialBox)
        {
            short x1, x2, z1, z2;

            x1            = Math.Min(SpecialBox.X1, SpecialBox.X2);
            x2            = Math.Max(SpecialBox.X1, SpecialBox.X2);
            z1            = Math.Min(SpecialBox.Z1, SpecialBox.Z2);
            z2            = Math.Max(SpecialBox.Z1, SpecialBox.Z2);
            SpecialBox.X1 = x1;
            SpecialBox.X2 = x2;
            SpecialBox.Z1 = z1;
            SpecialBox.Z2 = z2;
        }
        private String LoadSearchFiles(string filePath)
        {
            if (File.Exists(filePath))
            {
                SpecialBox dummybox = new SpecialBox();
                var        range    = new TextRange(dummybox.Document.ContentStart, dummybox.Document.ContentEnd);
                var        fStream  = new FileStream(filePath, FileMode.OpenOrCreate);
                range.Load(fStream, DataFormats.XamlPackage);

                // Debug.WriteLine("[" + filePath + "]: " + range.Text); // Test output showing text found in each loaded file, delete later

                fStream.Close();

                return(range.Text);
            }
            else
            {
                Debug.WriteLine("[ERROR file not loaded fixme");
                return("");
            }
        }
Example #7
0
 public ManagedSpecialBox(SpecialBox sb)
 {
     SpecialBox = sb;
     Load();
 }