예제 #1
0
        public override object EditValue(
            ITypeDescriptorContext context,
            IServiceProvider provider,
            object value)
        {
            if (context == null || provider == null)
            {
                return(base.EditValue(context, provider, value));
            }

            IWindowsFormsEditorService editorService =
                provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (editorService == null)
            {
                return(base.EditValue(context, provider, value));
            }

            TypeListBox list = new TypeListBox(editorService);

            list.Target = value as Type;
            editorService.DropDownControl(list);

            return(list.SelectedItem);
        }
예제 #2
0
 private void TypeListBox_ItemCheck(object sender, ItemCheckEventArgs e)
 {
     for (int ix = 0; ix < TypeListBox.Items.Count; ++ix)
     {
         if (ix != e.Index)
         {
             TypeListBox.SetItemChecked(ix, false);
         }
     }
 }
예제 #3
0
        /// <inheritdoc/>
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object Value)
        {
            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            Type    dataType = Value as Type;
            ListBox lb       = new TypeListBox();

            lb.BorderStyle           = BorderStyle.None;
            lb.SelectedItem          = dataType;
            lb.SelectedIndexChanged += new EventHandler(lb_SelectedIndexChanged);
            edSvc.DropDownControl(lb);
            return(lb.SelectedItem);
        }
예제 #4
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                edSvc.CloseDropDown();
                TypeListBox lst = new TypeListBox(edSvc);
                Type        t   = value as Type;
                if (t != null)
                {
                    lst.SelectType(t);
                }
                edSvc.DropDownControl(lst);
                value = lst.SelectedType;
            }
            return(value);
        }
예제 #5
0
        public override object EditValue(
            ITypeDescriptorContext context,
            IServiceProvider provider,
            object value)
        {
            if (context == null || provider == null)
                return base.EditValue(context, provider, value);

            IWindowsFormsEditorService editorService =
                provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            if (editorService == null)
                return base.EditValue(context, provider, value);

            TypeListBox list = new TypeListBox(editorService);
            list.Target = value as Type;
            editorService.DropDownControl(list);

            return list.SelectedItem;
        }
        public PluginSettingStoreCollectionEditor()
        {
            this.Content = placeholder = new Placeholder
            {
                Text         = "No plugins containing this type are installed.",
                ExtraContent = new Button
                {
                    Text    = "Open Plugin Manager",
                    Command = new Command((s, e) => App.Current.PluginManagerWindow.Show())
                }
            };

            mainContent = new Splitter
            {
                Panel1MinimumSize = 150,
                Panel1            = new Scrollable
                {
                    Border  = BorderType.None,
                    Content = sourceSelector = new TypeListBox <TSource>()
                },
                Panel2 = new Scrollable
                {
                    Content = settingStoreEditor = new ToggleablePluginSettingStoreEditor()
                    {
                        Padding = 5
                    }
                }
            };

            settingStoreEditor.StoreBinding.Bind(
                sourceSelector.SelectedItemBinding.Convert(t => StoreCollection?.FromType(t))
                );

            if (!Platform.IsMac) // Don't do this on macOS, causes poor UI performance.
            {
                settingStoreEditor.BackgroundColor = SystemColors.WindowBackground;
            }

            AppInfo.PluginManager.AssembliesChanged += HandleAssembliesChanged;
        }
예제 #7
0
 private void Main_Load(object sender, EventArgs e)
 {
     if (System.IO.File.Exists(@"DataLists\\CharacterList.db"))
     {
         EnableAccuracyMenu.Enabled = true;
     }
     if (System.IO.File.Exists(@"wcatBasicEditer.exe"))
     {
         DefaultDataMenuItem.Enabled = true;
     }
     if (System.IO.File.Exists(@"wcatCharaDBEditer.exe"))
     {
         wcatCharaMenuItem.Enabled = true;
     }
     if (!System.IO.File.Exists(@"DataLists\\SpecifiedBindList.db") || !System.IO.File.Exists(@"DataLists\\JobList.db") || !System.IO.File.Exists(@"DataLists\\TypeList.db") || !System.IO.File.Exists(@"DataLists\\MapList.db"))
     {
         MessageBox.Show("SpecifiedBindList.db、JobList.db、TypeList.db、MapListのいずれかが見つかりませんでした。", "", MessageBoxButtons.OK);
         Application.Exit();
     }
     serializer = new XmlSerializer(typeof(Settings));
     if (System.IO.File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\Settings.xml"))
     {
         sr       = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\Settings.xml");
         settings = (Settings)serializer.Deserialize(sr);
         sr.Close();
         EnableAccuracyMenu.Checked = settings._AccuracyEnabled;
         ResultOnNewWindow.Checked  = settings._ResultOnNewWindow;
     }
     else
     {
         sw = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\Settings.xml");
         settings.Save(EnableAccuracyMenu.Checked, ResultOnNewWindow.Checked);
         serializer.Serialize(sw, settings);
         sw.Close();
     }
     Timerfor4          = new Timer();
     Timerfor4.Tick    += new EventHandler(timerfor4);
     DesidePlace        = new Timer();
     DesidePlace.Tick  += new EventHandler(place);
     Timer4Custom       = new Timer();
     Timer4Custom.Tick += new EventHandler(custom);
     ConnectDB();
     LoadDefaultList(JobCmd, "SELECT Job FROM JobList", JobListBox, "Job", JobCon);
     LoadDefaultList(TypeCmd, "SELECT Type FROM TypeList", TypeListBox, "Type", TypeCon);
     LoadDefaultList(BindCmd, "SELECT Bind FROM SpecifiedBindList", SpecifiedListBox, "Bind", BindCon);
     RefreshMapList();
     RefreshCustomList();
     RefreshTeamList();
     for (int cnt = 0; cnt < JobListBox.Items.Count; cnt++)
     {
         JobListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < TypeListBox.Items.Count; cnt++)
     {
         TypeListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < RarityListBox.Items.Count; cnt++)
     {
         RarityListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < RareTypeListBox.Items.Count; cnt++)
     {
         RareTypeListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < AttributeListBox.Items.Count; cnt++)
     {
         AttributeListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < SortListBox.Items.Count; cnt++)
     {
         SortListBox.SetItemChecked(cnt, true);
     }
     for (int cnt = 0; cnt < SpecifiedListBox.Items.Count; cnt++)
     {
         SpecifiedListBox.SetItemChecked(cnt, true);
     }
 }
예제 #8
0
        public string SetConditions()
        {
            string ErrorMsg = null;

            if (JobEnabled.Checked)
            {
                JobList.Clear();
                for (int i = 0; i <= (JobListBox.Items.Count - 1); i++)
                {
                    if (JobListBox.GetItemChecked(i))
                    {
                        JobList.Add(JobListBox.Items[i].ToString());
                    }
                }
                if (JobList.Count != 0)
                {
                    if (OneJobOnly.Checked)
                    {
                        job = Convert.ToString((string)JobList[random.Next(0, JobList.Count)]);
                    }
                    if (JobList.Count < 4 && JobExistFalse.Checked)
                    {
                        Error     = true;
                        ErrorMsg += ("職業を被らせない設定は選択している職業数が4つ以上である必要があります。\n");
                    }
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("職業が選択されていません。\n");
                }
            }
            if (TypeEnabled.Checked)
            {
                TypeList.Clear();
                for (int i = 0; i <= (TypeListBox.Items.Count - 1); i++)
                {
                    if (TypeListBox.GetItemChecked(i))
                    {
                        TypeList.Add(TypeListBox.Items[i].ToString());
                    }
                }
                if (TypeList.Count != 0)
                {
                    if (OneTypeOnly.Checked)
                    {
                        type = Convert.ToString((string)TypeList[random.Next(0, TypeList.Count)]);
                    }
                    if (TypeList.Count < 4 && TypeExistFalse.Checked)
                    {
                        Error     = true;
                        ErrorMsg += ("タイプを被らせない設定は選択しているタイプ数が4つ以上である必要があります。\n");
                    }
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("タイプが選択されていません。\n");
                }
            }
            if (RarityEnabled.Checked)
            {
                RareList.Clear();
                if (UseRarity.Checked)
                {
                    for (int i = 0; i <= (RarityListBox.Items.Count - 1); i++)
                    {
                        if (RarityListBox.GetItemChecked(i))
                        {
                            RareList.Add(RarityListBox.Items[i].ToString());
                        }
                    }
                    TRResult.Text = "";
                    if (RareList.Count == 0)
                    {
                        Error     = true;
                        ErrorMsg += ("レアリティが選択されていません。\n");
                    }
                }
                if (UseTotalRarity.Checked)
                {
                    TRResult.Text = "レアリティ合計値:" + random.Next((int)TRMinimum.Value, (int)TRMax.Value);
                }
            }
            if (RareTypeEnabled.Checked)
            {
                RareTypeList.Clear();
                for (int i = 0; i <= (RareTypeListBox.Items.Count - 1); i++)
                {
                    if (RareTypeListBox.GetItemChecked(i))
                    {
                        RareTypeList.Add(RareTypeListBox.Items[i].ToString());
                    }
                }
                if (RareTypeList.Count != 0)
                {
                    if (OneRareTypeOnly.Checked)
                    {
                        raretype = Convert.ToString((string)RareTypeList[random.Next(0, RareTypeList.Count)]);
                    }
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("種類が選択されていません。\n");
                }
            }
            if (AttributeEnabled.Checked)
            {
                AttributeList.Clear();
                for (int i = 0; i <= (AttributeListBox.Items.Count - 1); i++)
                {
                    if (AttributeListBox.GetItemChecked(i))
                    {
                        AttributeList.Add(AttributeListBox.Items[i].ToString());
                    }
                }
                if (AttributeList.Count != 0)
                {
                    attribute = Convert.ToString((string)AttributeList[random.Next(0, AttributeList.Count)]);
                }
                else
                {
                    Error     = true;
                    ErrorMsg += ("属性が選択されていません。\n");
                }
            }
            if (!JobEnabled.Checked && !TypeEnabled.Checked && !RarityEnabled.Checked && !RareTypeEnabled.Checked && !AttributeEnabled.Checked)
            {
                Error     = true;
                ErrorMsg += ("有効になっている条件がありません。");
            }
            return(ErrorMsg);
        }