Пример #1
0
        public AdvancedMode()
        {
            InitializeComponent();

            LuaFileView.SelectionChanged += LuaFileView_SelectionChanged;
            FileManager.LoadAllFiles();

            inst      = this;
            Focusable = true;

            StartupValues val = LHregistry.GetStartupValues();

            //SimpleMode.LastFileOpened = val.LastSimpleFileSelected;
            textEditor.FontSize = val.StartFontSize;
            textEditor.Text     = "function Start()\n	print(\"preview\")\nend\n\n\n\n\n\n\n\n";
            LoadFileFromId(val.StartupFileId);

            textEditor.InputBindings.Add(
                new InputBinding(new SaveCommand(),
                                 new KeyGesture(Key.S, ModifierKeys.Control)
                                 ));
            textEditor.InputBindings.Add(
                new InputBinding(new LineToggleCommand(),
                                 new KeyGesture(Key.L, ModifierKeys.Control)
                                 ));
            textEditor.ShowLineNumbers = Convert.ToBoolean(val.ShowLineNumbers);

            //set file view to the listbox
            Listbox = LuaFileView;
            StyleLuaListbox();

            //get all the filenames from registry
            int len = LHregistry.GetAllFilenames().Length;

            for (int i = 0; i < len; i++)
            {
                Label  txtbox    = new Label();
                string wholePath = LHregistry.GetAllFilenames()[i];
                txtbox.Content = LHregistry.getSimpleName(wholePath);

                styleLabel(txtbox);
                txtbox.Foreground = white;
                txtbox.Background = transparent;

                LuaFileView.Items.Add(txtbox);
            }

            BypassTextChangedEvent = true;

            //Alle icoontjes
            PlusIcon.Source   = ImageSourceFromBitmap(LeHandUI.Properties.Resources.PALE_GREEN_AddIcon64x64);
            DeleteIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.WASHED_OUT_RED_DeleteIcon64x64);
            //RefreshIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.AQUA_RefreshIcon64x64);
            //AddReferenceIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.AddReference16x16);
            SaveIcon.Source    = ImageSourceFromBitmap(LeHandUI.Properties.Resources.SaveScript64x64);
            RunPrgmIcon.Source = ImageSourceFromBitmap(LeHandUI.Properties.Resources.StartScript64x64);
        }
Пример #2
0
 /// <summary>
 /// creates new file, returns -1 if failed
 /// </summary>
 /// <param name="filepath">full path of </param>
 /// <returns></returns>
 public static void LoadAllFiles()
 {
     string[] filenames = LHregistry.GetAllFilenames();
     int[]    fileids   = LHregistry.GetAllFileIds();
     for (int i = 0; i < fileids.Length; i++)
     {
         files[fileids[i]] = LHregistry.GetFile(fileids[i]);
     }
 }
Пример #3
0
        private void RefreshLuaScript()
        {
            List <string> LuaNames = new List <string>(LHregistry.GetAllFilenames());

            int currOpenedFileId = FileManager.currentLoadedIndex;


            for (int i = 0; i < LuaNames.Count; i++)
            {
                Label currLuaFileViewLabel = (Label)(LuaFileView.Items[i]);

                if (LuaNames[i] == (string)currLuaFileViewLabel.Content)
                {
                    continue;
                }
                else
                {
                    Label label = new Label();
                    label.Name    = "TxtBox" + i.ToString();
                    label.Content = LHregistry.getSimpleName(LuaNames[i]);

                    if (FileManager.isFileNotSaved[i])
                    {
                        label.Content += "*";
                    }

                    if (currOpenedFileId == i)
                    {
                        styleOpenedFileLabel(label);
                    }
                    else
                    {
                        styleLabel(label);
                    }
                    LuaFileView.Items.RemoveAt(i);
                    LuaFileView.Items.Insert(i, label);
                }
            }
            LuaFileView.Items.Refresh();
        }