Beispiel #1
0
        public SettingsWindow(Action <List <FileExplorerWindow.UrlLocation>, bool> SaveCallback)
        {
            customEditorClass = new CustomEditorClass(this);
            InitializeComponent();
            RegisterEvents();

            this.SaveCallback += SaveCallback;

            this.listView1.ListViewItemSorter = new CustomEditorClass.ListViewItemComparer(1);

            checkBox1.Checked = Properties.Settings.Default.REMEMBER_ME;
            checkBox2.Checked = Properties.Settings.Default.REMEMBER_LOCATION;

            comboBox1.SelectedItem = Properties.Settings.Default.DOUBLE_CLICK_ACTION;
            //System.Windows.Forms.ListViewItem listViewItem;

            //int index = 0;
            foreach (string location in Properties.Settings.Default.LOCATIONS)
            {
                string[] data = location.Split(';');

                if (data.Count() < 4)
                {
                    MessageBox.Show(string.Format("Could Not Parse {0}...", location), "Invalid Location");
                    continue;
                }

                FileExplorerWindow.UrlLocation urlLocation = new FileExplorerWindow.UrlLocation(data[0], int.Parse(data[1]), data[2], data[3]);

                addItem(urlLocation, -1);
                //index++;
            }

            listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Beispiel #2
0
        public bool SetData(FileExplorerWindow.UrlLocation dataItems, string name)
        {
            this.dataItem = dataItems;
            this.Text     = name + " Screen";

            NameTextBox.Text        = dataItems.Name;
            BaseAddressTextBox.Text = dataItems.BaseAddress;
            URLTextBox.Text         = dataItems.Url;


            if (dataItems.Index >= 0)
            {
                IndexTextBox.Text = dataItems.Index.ToString();
                IndexTextBox.Tag  = dataItems.Index;

                return(true);
            }
            else
            {
                IndexTextBox.Text = (customEditorClass.GetListViewSize()).ToString();
                IndexTextBox.Tag  = customEditorClass.GetListViewSize();

                return(false);
            }
        }
Beispiel #3
0
        public void EditScreen_Close(FileExplorerWindow.UrlLocation newDataItem)
        {
            ListViewItem listviewitem = FindListViewByIndex(newDataItem.Index);

            if (listviewitem == null || (int)listviewitem.Tag == newDataItem.Index)
            {
                customEditor.editScreen = null;
            }

            /*
             * else
             * {
             *  throw new NotImplementedException("Wowza");
             * }
             */

            if (listviewitem != null)
            {
                listviewitem.Checked = false;
            }
            else
            {
                //closeAddEditPanel();
                itemChecked();
            }
        }
Beispiel #4
0
        public void addItem(FileExplorerWindow.UrlLocation dataItem, int index)
        {
            /*
             * listViewItem = new System.Windows.Forms.ListViewItem(new string[] {
             *      data[0], data[1], data[2]}, -1);
             *
             *  listViewItem.Tag = urlLocation;
             *
             *  listView1.Items.Add(listViewItem);
             */


            ListViewItem item1 = new ListViewItem(dataItem.Name);

            item1.SubItems.Add(dataItem.Index.ToString());
            item1.SubItems.Add(dataItem.BaseAddress);
            item1.SubItems.Add(dataItem.Url);

            item1.Name = dataItem.Index.ToString();
            item1.Tag  = dataItem.Index;

            string name;

            if ((name = customEditorClass.FindListViewNameByIndex(dataItem.Index)) != null && listView1.Items.ContainsKey(name))
            {
                listView1.Items[listView1.Items.IndexOfKey(name)] = item1;
            }
            else
            {
                listView1.Items.Add(item1);
            }

            //listView1.Items[listView1.Items.IndexOfKey(dataItem.Name)].EnsureVisible();
            listView1.Sort();
        }
Beispiel #5
0
        public EditScreen(CustomEditorClass customEditorClass, FileExplorerWindow.UrlLocation customClass, int index, string name)
        {
            this.Tag = index;
            //this.customEditorClass = customeditorclass;

            this.customEditorClass = customEditorClass;
            initializeComponent(customEditorClass.customEditor.GetType());

            RegisterEvents();

            SetData(customClass, name);
        }
Beispiel #6
0
        public void EditScreen_Save(FileExplorerWindow.UrlLocation newDataItem, int index)
        {
            ListViewItem listviewitem;

            if ((listviewitem = FindListViewByIndex(newDataItem.Index)) != null)
            {
                customEditor.Remove(listviewitem);
            }

            if (customEditor.editScreen != null)
            {
                customEditor.editScreen.Close();
            }

            customEditor.addItem(newDataItem, index);
            customEditor.OnNewTextChanged(new TextEventArgs(index, newDataItem));

            itemChecked();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //AddBookmarkWindow bookmarkWindow = new AddBookmarkWindow();
            //bookmarkWindow.Show();

            //return;
            user = new KeyValuePair <string, string>(textBox2.Text, textBox1.Text);
            url  = ((FileExplorerWindow.UrlLocation)comboBox1.SelectedItem);
            // url = new KeyValuePair<string, string>(((UrlLocation)comboBox1.SelectedItem).BaseAddress, String.Format(((UrlLocation)comboBox1.SelectedItem).Url, textBox2.Text));

            using (HttpClient client = FileExplorerWindow.CreateHttpClient(url.BaseAddress, user))
                if (FileExplorerWindow.CheckIfExists(new FileExplorerWindow.HttpInfo(client, new FileExplorerWindow.LinkInfo(String.Format(url.Url, textBox2.Text), url, url.FolderName, "Directory", null, "Directory"), user)))
                {
                    DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Username and/or Password Were Incorrect.\nPlease Try Again...", "Invalid Login");
                }
        }
Beispiel #8
0
 public void EditScreen_Save(FileExplorerWindow.UrlLocation newDataItem, int index)
 {
     customEditorClass.EditScreen_Save(newDataItem, index);
     //ImageSanityCheck();
 }
Beispiel #9
0
 public TextEventArgs(int index, FileExplorerWindow.UrlLocation text)
 {
     this.text  = text;
     this.index = index;
 }